diff options
author | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-19 19:19:51 (GMT) |
---|---|---|
committer | Mohamad Chaarawi <chaarawi@hdfgroup.org> | 2014-08-19 19:19:51 (GMT) |
commit | aff0124b38f2ba19cd06431f756ff5791882dbae (patch) | |
tree | 7b00758d1f5f6a45690d21971c868d111a35367c /src/H5VL.c | |
parent | ffc4b3a7f73e9e808bcb11a5f86ce9d6229f31f8 (diff) | |
download | hdf5-aff0124b38f2ba19cd06431f756ff5791882dbae.zip hdf5-aff0124b38f2ba19cd06431f756ff5791882dbae.tar.gz hdf5-aff0124b38f2ba19cd06431f756ff5791882dbae.tar.bz2 |
[svn-r25537] VOL framework changes.
Diffstat (limited to 'src/H5VL.c')
-rw-r--r-- | src/H5VL.c | 1315 |
1 files changed, 455 insertions, 860 deletions
@@ -437,7 +437,6 @@ done: * Purpose: Creates an attribute through the VOL * * Return: Success: pointer to the new attr. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -447,7 +446,7 @@ done: */ void * H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -455,7 +454,7 @@ H5VLattr_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, con if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, vol_plugin, name, acpl_id, aapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_attr_create(obj, loc_params, vol_plugin, name, acpl_id, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create attribute") done: @@ -469,7 +468,6 @@ done: * Purpose: Opens an attribute through the VOL * * Return: Success: pointer to the new attr. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -479,7 +477,7 @@ done: */ void * H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t aapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t aapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -487,7 +485,7 @@ H5VLattr_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, vol_plugin, name, aapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_attr_open(obj, loc_params, vol_plugin, name, aapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open attribute") done: @@ -509,7 +507,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, hid_t dxpl_id, void UNUSED **req) +herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -517,7 +515,7 @@ herr_t H5VLattr_read(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, void *bu if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_read(attr, vol_plugin, mem_type_id, buf, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_read(attr, vol_plugin, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read attribute") done: @@ -531,7 +529,6 @@ done: * Purpose: Writes data to attr through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -539,7 +536,7 @@ done: * *------------------------------------------------------------------------- */ -herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void UNUSED **req) +herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -547,7 +544,7 @@ herr_t H5VLattr_write(void *attr, H5VL_t *vol_plugin, hid_t mem_type_id, const v if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_write(attr, vol_plugin, mem_type_id, buf, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_write(attr, vol_plugin, mem_type_id, buf, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write attribute") done: @@ -556,44 +553,47 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLattr_iterate + * Function: H5VLattr_get * - * Purpose: Iterate over attrs in a group + * Purpose: Get specific information about the attribute through the VOL * * Return: Success: non negative * Failure: negative * * Programmer: Mohamad Chaarawi - * June, 2013 + * March, 2012 * *------------------------------------------------------------------------- */ -herr_t H5VLattr_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5_index_t idx_type, H5_iter_order_t order, hsize_t *n, - H5A_operator2_t op, void *op_data, hid_t dxpl_id, void UNUSED **req) +herr_t +H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*x*xVai**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_iterate(obj, loc_params, vol_plugin, idx_type, order, n, - op, op_data, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Attr iteration failed") + + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->attr_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr get' method") + if((ret_value = (vol_plugin->cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to get attribute information") done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_iterate() */ + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_get() */ /*------------------------------------------------------------------------- - * Function: H5VLattr_get + * Function: H5VLattr_specific * - * Purpose: Get specific information about the attribute through the VOL + * Purpose: specific operation on attributes through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -602,118 +602,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_get(void *obj, H5VL_t *vol_plugin, H5VL_attr_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLattr_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVai**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE7("e", "*xx*xVbi**xx", obj, loc_params, vol_plugin, specific_type, + dxpl_id, req, arguments); if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Aexists/exists_by_name */ - case H5VL_ATTR_EXISTS: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - char *attr_name = va_arg (arguments, char *); - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - loc_params, attr_name, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_space */ - case H5VL_ATTR_GET_SPACE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_type */ - case H5VL_ATTR_GET_TYPE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_create_plist */ - case H5VL_ATTR_GET_ACPL: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_name */ - case H5VL_ATTR_GET_NAME: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - size_t buf_size = va_arg (arguments, size_t); - char *buf = va_arg (arguments, char *); - ssize_t *ret_val = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - loc_params, buf_size, buf, ret_val)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - /* H5Aget_info */ - case H5VL_ATTR_GET_INFO: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - H5A_info_t *ainfo = va_arg (arguments, H5A_info_t *); - - if(H5VL_OBJECT_BY_SELF == loc_params.type) { - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - } - else if(H5VL_OBJECT_BY_NAME == loc_params.type) { - char *attr_name = va_arg (arguments, char *); - - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo, attr_name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - } - else if(H5VL_OBJECT_BY_IDX == loc_params.type) { - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, ainfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - } - else - HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get name of attr") - - break; - } - case H5VL_ATTR_GET_STORAGE_SIZE: - { - hsize_t *ret = va_arg (arguments, hsize_t *); - if((ret_value = H5VL_attr_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get attribute information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from attr") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->attr_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr specific' method") + if((ret_value = (vol_plugin->cls->attr_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute specific callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_get() */ +} /* end H5VLattr_specific() */ /*------------------------------------------------------------------------- - * Function: H5VLattr_remove - * - * Purpose: Removes an attribute through the VOL + * Function: H5VLattr_optional * - * Return: Success: Non Negative + * Purpose: optional operation specific to plugins. * - * Failure: Negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 @@ -721,23 +640,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - const char *attr_name, hid_t dxpl_id, void UNUSED **req) +H5VLattr_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xx*x*si**x", obj, loc_params, vol_plugin, attr_name, dxpl_id, - req); + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_remove(obj, loc_params, vol_plugin, attr_name, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to remove attribute") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == vol_plugin->cls->attr_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `attr optional' method") + if((ret_value = (vol_plugin->cls->attr_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute attribute optional callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLattr_remove() */ +} /* end H5VLattr_optional() */ /*------------------------------------------------------------------------- @@ -746,7 +667,6 @@ done: * Purpose: Closes an attribute through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -755,7 +675,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -764,7 +684,7 @@ H5VLattr_close(void *attr, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) if (NULL == attr || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_attr_close(attr, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_attr_close(attr, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close attribute") done: @@ -778,7 +698,6 @@ done: * Purpose: Commits a datatype to the file through the VOL * * Return: Success: Positive - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -788,7 +707,7 @@ done: */ void * H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -797,7 +716,7 @@ H5VLdatatype_commit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_datatype_commit(obj, loc_params, vol_plugin, name, type_id, - lcpl_id, tcpl_id, tapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + lcpl_id, tcpl_id, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to commit datatype") done: @@ -811,7 +730,6 @@ done: * Purpose: Opens a named datatype through the VOL * * Return: Success: User ID of the datatype. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -821,7 +739,7 @@ done: */ void * H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t tapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t tapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -829,7 +747,7 @@ H5VLdatatype_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, c if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_datatype_open(obj, loc_params, vol_plugin, name, tapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open datatype") done: @@ -838,35 +756,74 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLdatatype_get_binary + * Function: H5VLdatatype_specific + * + * Purpose: specific operation on datatypes through the VOL + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 * - * Purpose: gets required size to serialize datatype description + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_specific(void *obj, H5VL_t *vol_plugin, H5VL_datatype_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*x*xVfi**xx", obj, vol_plugin, specific_type, dxpl_id, req, + arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->datatype_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype specific' method") + if((ret_value = (vol_plugin->cls->datatype_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional * - * Return: Success: size needed + * Purpose: optional operation specific to plugins. * - * Failure: negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 * *------------------------------------------------------------------------- */ -ssize_t -H5VLdatatype_get_binary(void *obj, H5VL_t *vol_plugin, void *buf, size_t size, hid_t dxpl_id, void UNUSED **req) +herr_t +H5VLdatatype_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { - ssize_t ret_value = FAIL; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("Zs", "*x*x*xzi**x", obj, vol_plugin, buf, size, dxpl_id, req); + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_datatype_get_binary(obj, vol_plugin, buf, size, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to encode datatype") + + if(NULL == vol_plugin->cls->datatype_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype optional' method") + if((ret_value = (vol_plugin->cls->datatype_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute datatype optional callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLdatatype_get_binary() */ +} /* end H5VLdatatype_optional() */ /*------------------------------------------------------------------------- @@ -875,7 +832,6 @@ done: * Purpose: Get specific information about the datatype through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -885,30 +841,21 @@ done: */ herr_t H5VLdatatype_get(void *obj, H5VL_t *vol_plugin, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVti**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*xVei**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Tget_create_plist */ - case H5VL_DATATYPE_GET_TCPL: - { - hid_t *new_tcpl_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_datatype_get(obj, vol_plugin, get_type, dxpl_id, - H5_EVENT_STACK_NULL, new_tcpl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get datatype information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from datatype") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->datatype_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `datatype get' method") + if((ret_value = (vol_plugin->cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute datatype get callback") done: FUNC_LEAVE_API(ret_value) @@ -929,7 +876,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -938,7 +885,7 @@ H5VLdatatype_close(void *dt, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **re if (NULL == dt || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_datatype_close(dt, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_datatype_close(dt, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close datatype") done: @@ -952,7 +899,6 @@ done: * Purpose: Creates a dataset through the VOL * * Return: Success: pointer to dataset - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -962,7 +908,7 @@ done: */ void * H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -971,7 +917,7 @@ H5VLdataset_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_dataset_create(obj, loc_params, vol_plugin, name, - dcpl_id, dapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + dcpl_id, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create dataset") done: @@ -985,7 +931,6 @@ done: * Purpose: Opens a dataset through the VOL * * Return: Success: pointer to dataset - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -995,7 +940,7 @@ done: */ void * H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t dapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t dapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -1003,7 +948,7 @@ H5VLdataset_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, co if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_dataset_open(obj, loc_params, vol_plugin, name, dapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open dataset") done: @@ -1015,9 +960,8 @@ done: * Function: H5VLdataset_read * * Purpose: Reads data from dataset through the VOL -* - * Return: Success: Non Negative * + * Return: Success: Non Negative * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1027,7 +971,7 @@ done: */ herr_t H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, void *buf, void UNUSED **req) + hid_t file_space_id, hid_t plist_id, void *buf, void **req) { herr_t ret_value = SUCCEED; @@ -1038,7 +982,7 @@ H5VLdataset_read(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_sp if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") if((ret_value = H5VL_dataset_read(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, H5_EVENT_STACK_NULL)) < 0) + plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") done: @@ -1052,7 +996,6 @@ done: * Purpose: Writes data from dataset through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1062,7 +1005,7 @@ done: */ herr_t H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_space_id, - hid_t file_space_id, hid_t plist_id, const void *buf, void UNUSED **req) + hid_t file_space_id, hid_t plist_id, const void *buf, void **req) { herr_t ret_value = SUCCEED; @@ -1073,7 +1016,7 @@ H5VLdataset_write(void *dset, H5VL_t *vol_plugin, hid_t mem_type_id, hid_t mem_s if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") if((ret_value = H5VL_dataset_write(dset, vol_plugin, mem_type_id, mem_space_id, file_space_id, - plist_id, buf, H5_EVENT_STACK_NULL)) < 0) + plist_id, buf, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") done: @@ -1082,13 +1025,12 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLdataset_set_extent - * - * Purpose: Modifies the dimensions of a dataset + * Function: H5VLdataset_get * - * Return: Success: Non Negative + * Purpose: Get specific information about the dataset through the VOL * - * Failure: Negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 @@ -1096,30 +1038,35 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_set_extent(void *dset, H5VL_t *vol_plugin, const hsize_t size[], hid_t dxpl_id, void UNUSED **req) +H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*x*x*hi**x", dset, vol_plugin, size, dxpl_id, req); + H5TRACE6("e", "*x*xVci**xx", dset, vol_plugin, get_type, dxpl_id, req, + arguments); if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_dataset_set_extent(dset, vol_plugin, size, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to set extent of dataset") + + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->dataset_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset get' method") + if((ret_value = (vol_plugin->cls->dataset_cls.get)(dset, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute dataset get callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_set_extent() */ +} /* end H5VLdataset_get() */ /*------------------------------------------------------------------------- - * Function: H5VLdataset_get + * Function: H5VLdataset_specific * - * Purpose: Get specific information about the dataset through the VOL + * Purpose: specific operation on datasets through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -1128,88 +1075,61 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *dset, H5VL_t *vol_plugin, H5VL_dataset_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLdataset_specific(void *obj, H5VL_t *vol_plugin, H5VL_dataset_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVdi**xx", dset, vol_plugin, get_type, dxpl_id, req, + H5TRACE6("e", "*x*xVdi**xx", obj, vol_plugin, specific_type, dxpl_id, req, arguments); - if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Dget_space */ - case H5VL_DATASET_GET_SPACE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_space_statuc */ - case H5VL_DATASET_GET_SPACE_STATUS: - { - H5D_space_status_t *allocation = va_arg (arguments, H5D_space_status_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, allocation)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_type */ - case H5VL_DATASET_GET_TYPE: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_create_plist */ - case H5VL_DATASET_GET_DCPL: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_access_plist */ - case H5VL_DATASET_GET_DAPL: - { - hid_t *ret_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_storage_size */ - case H5VL_DATASET_GET_STORAGE_SIZE: - { - hsize_t *ret = va_arg (arguments, hsize_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - /* H5Dget_offset */ - case H5VL_DATASET_GET_OFFSET: - { - haddr_t *ret = va_arg (arguments, haddr_t *); - - if((ret_value = H5VL_dataset_get(dset, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get dataset information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from dataset") - } + if(NULL == vol_plugin->cls->dataset_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset specific' method") + if((ret_value = (vol_plugin->cls->dataset_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset specific callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLdataset_get() */ +} /* end H5VLdataset_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLdataset_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->dataset_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `dataset optional' method") + if((ret_value = (vol_plugin->cls->dataset_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute dataset optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_optional() */ /*------------------------------------------------------------------------- @@ -1218,7 +1138,6 @@ done: * Purpose: Closes a dataset through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1227,7 +1146,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1236,7 +1155,7 @@ H5VLdataset_close(void *dset, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **r if (NULL == dset || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_dataset_close(dset, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_dataset_close(dset, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close dataset") done: @@ -1250,7 +1169,6 @@ done: * Purpose: Creates a file through the VOL * * Return: Success: pointer to file. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -1260,13 +1178,13 @@ done: */ void * H5VLfile_create(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t fapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ FUNC_ENTER_API(NULL) - if(NULL == (ret_value = H5VL_file_create(vol_plugin, name, flags, fcpl_id, fapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_file_create(vol_plugin, name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: @@ -1280,7 +1198,6 @@ done: * Purpose: Opens a file through the VOL. * * Return: Success: pointer to file. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -1289,13 +1206,13 @@ done: *------------------------------------------------------------------------- */ void * -H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void UNUSED **req) +H5VLfile_open(H5VL_t **vol_plugin, const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ FUNC_ENTER_API(NULL) - if(NULL == (ret_value = H5VL_file_open(vol_plugin, name, flags, fapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_file_open(vol_plugin, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create file") done: @@ -1304,45 +1221,11 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLfile_flush - * - * Purpose: Flushes a file through the VOL - * - * Return: Success: Non Negative - * - * Failure: Negative - * - * Programmer: Mohamad Chaarawi - * February, 2012 - * - *------------------------------------------------------------------------- - */ -herr_t -H5VLfile_flush(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - H5F_scope_t scope, hid_t dxpl_id, void UNUSED **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*xx*xFsi**x", obj, loc_params, vol_plugin, scope, dxpl_id, req); - - if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_file_flush(obj, loc_params, vol_plugin, scope, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to flush file") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_flush() */ - - -/*------------------------------------------------------------------------- * Function: H5VLfile_get * * Purpose: Get specific information about the file through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -1351,94 +1234,23 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLfile_get(void *file, H5VL_t *vol_plugin, H5VL_file_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVfi**xx", file, vol_plugin, get_type, dxpl_id, req, + H5TRACE6("e", "*x*xVgi**xx", file, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Fget_access_plist */ - case H5VL_FILE_GET_FAPL: - { - hid_t *plist_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, plist_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_create_plist */ - case H5VL_FILE_GET_FCPL: - { - hid_t *plist_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, plist_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_obj_count */ - case H5VL_FILE_GET_OBJ_COUNT: - { - unsigned types = va_arg (arguments, unsigned); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, types, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_obj_ids */ - case H5VL_FILE_GET_OBJ_IDS: - { - unsigned types = va_arg (arguments, unsigned); - size_t max_objs = va_arg (arguments, size_t); - hid_t *oid_list = va_arg (arguments, hid_t *); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, types, max_objs, - oid_list, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_intent */ - case H5VL_FILE_GET_INTENT: - { - unsigned *ret = va_arg (arguments, unsigned *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5Fget_name */ - case H5VL_FILE_GET_NAME: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - size_t size = va_arg (arguments, size_t); - char *name = va_arg (arguments, char *); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, type, size, - name, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - /* H5I_get_file_id */ - case H5VL_OBJECT_GET_FILE: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - void **ret = va_arg (arguments, void **); - - if((ret_value = H5VL_file_get(file, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, type, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get file information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information") - } /* end switch */ + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->file_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file get' method") + if((ret_value = (vol_plugin->cls->file_cls.get)(file, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute file get callback") done: FUNC_LEAVE_API(ret_value) @@ -1446,9 +1258,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLfile_misc + * Function: H5VLfile_specific * - * Purpose: perform a specified operation through the VOL + * Purpose: perform File specific operations through the VOL * * Return: Success: non negative * Failure: negative @@ -1459,60 +1271,49 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_misc(void *file, H5VL_t *vol_plugin, H5VL_file_misc_t misc_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLfile_specific(void *file, H5VL_t *vol_plugin, H5VL_file_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVmi**xx", file, vol_plugin, misc_type, dxpl_id, req, + H5TRACE6("e", "*x*xVhi**xx", file, vol_plugin, specific_type, dxpl_id, req, arguments); - if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + if(specific_type == H5VL_FILE_IS_ACCESSIBLE) { + H5P_genplist_t *plist; /* Property list pointer */ + hid_t vol_id; /* VOL plugin identigier attached to fapl_id */ + H5VL_class_t *vol_cls; /* VOL class of vol_id */ + hid_t fapl_id; - switch (misc_type) { - /* H5Fmount */ - case H5VL_FILE_MOUNT: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - const char *name = va_arg (arguments, const char *); - H5F_t *child = va_arg (arguments, H5F_t *); - hid_t plist_id = va_arg (arguments, hid_t); - - if((ret_value = H5VL_file_misc(file, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, - type, name, child, plist_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - - break; - } - /* H5Fmount */ - case H5VL_FILE_UNMOUNT: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - const char *name = va_arg (arguments, const char *); - - if((ret_value = H5VL_file_misc(file, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, type, name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fis_accessible */ - case H5VL_FILE_IS_ACCESSIBLE: - { - hid_t fapl_id = va_arg (arguments, hid_t); - const char *name = va_arg (arguments, const char *); - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_file_misc(file, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, fapl_id, name, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + fapl_id = va_arg (arguments, hid_t); + + /* get the VOL info from the fapl */ + if(NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list") + if(H5P_get(plist, H5F_ACS_VOL_ID_NAME, &vol_id) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get vol plugin") + + if(NULL == (vol_cls = (H5VL_class_t *)H5I_object(vol_id))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL ID") + if((ret_value = (vol_cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "specific failed") + } + else { + if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->file_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file specific' method") + if((ret_value = (vol_plugin->cls->file_cls.specific) + (file, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file specific callback") + } done: FUNC_LEAVE_API(ret_value) -} /* end H5VLfile_misc() */ +} /* end H5VLfile_specific() */ /*------------------------------------------------------------------------- @@ -1529,145 +1330,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *file, H5VL_t *vol_plugin, H5VL_file_optional_t optional_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLfile_optional(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVni**xx", file, vol_plugin, optional_type, dxpl_id, req, - arguments); + H5TRACE5("e", "*x*xi**xx", file, vol_plugin, dxpl_id, req, arguments); if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (optional_type) { - /* H5Fget_filesize */ - case H5VL_FILE_GET_SIZE: - { - hsize_t *ret = va_arg (arguments, hsize_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_file_image */ - case H5VL_FILE_GET_FILE_IMAGE: - { - void *buf_ptr = va_arg (arguments, void *); - ssize_t *ret = va_arg (arguments, ssize_t *); - size_t buf_len = va_arg (arguments, size_t ); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, - buf_ptr, ret, buf_len)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_freespace */ - case H5VL_FILE_GET_FREE_SPACE: - { - hssize_t *ret = va_arg (arguments, hssize_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - case H5VL_FILE_GET_FREE_SECTIONS: - { - H5F_sect_info_t *sect_info = va_arg (arguments, H5F_sect_info_t *); - ssize_t *ret = va_arg (arguments, ssize_t *); - H5F_mem_t type = va_arg (arguments, H5F_mem_t); - size_t nsects = va_arg (arguments, size_t); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, - sect_info, ret, type, nsects)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_info2 */ - case H5VL_FILE_GET_INFO: - { - H5I_type_t type = va_arg (arguments, H5I_type_t); - H5F_info2_t *finfo = va_arg (arguments, H5F_info2_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, type, finfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_mdc_config */ - case H5VL_FILE_GET_MDC_CONF: - { - H5AC_cache_config_t *config_ptr = va_arg (arguments, H5AC_cache_config_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, config_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_mdc_hit_rate */ - case H5VL_FILE_GET_MDC_HR: - { - double *hit_rate_ptr = va_arg (arguments, double *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, hit_rate_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_mdc_size */ - case H5VL_FILE_GET_MDC_SIZE: - { - size_t *max_size_ptr = va_arg (arguments, size_t *); - size_t *min_clean_size_ptr = va_arg (arguments, size_t *); - size_t *cur_size_ptr = va_arg (arguments, size_t *); - int *cur_num_entries_ptr = va_arg (arguments, int *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, max_size_ptr, - min_clean_size_ptr, cur_size_ptr, cur_num_entries_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fget_vfd_handle */ - case H5VL_FILE_GET_VFD_HANDLE: - { - void **file_handle = va_arg (arguments, void **); - hid_t fapl = va_arg (arguments, hid_t); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, file_handle, fapl)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Fclear_elink_file_cache */ - case H5VL_FILE_CLEAR_ELINK_CACHE: - { - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Freopen */ - case H5VL_FILE_REOPEN: - { - void **ret = va_arg (arguments, void **); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - /* H5Freset_mdc_hit_rate_stats */ - case H5VL_FILE_RESET_MDC_HIT_RATE: - { - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - case H5VL_FILE_SET_MDC_CONFIG: - { - H5AC_cache_config_t *config_ptr = va_arg (arguments, H5AC_cache_config_t *); - - if((ret_value = H5VL_file_optional(file, vol_plugin, optional_type, dxpl_id, H5_EVENT_STACK_NULL, config_ptr)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to operate on the file") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + if(NULL == vol_plugin->cls->file_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `file optional' method") + if((ret_value = (vol_plugin->cls->file_cls.optional)(file, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute file optional callback") done: FUNC_LEAVE_API(ret_value) @@ -1680,7 +1356,6 @@ done: * Purpose: Closes a file through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1689,7 +1364,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1698,7 +1373,7 @@ H5VLfile_close(void *file, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) if(NULL == file || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_file_close(file, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_file_close(file, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close file") done: @@ -1710,7 +1385,6 @@ done: * Function: H5VLgroup_create * * Purpose: Creates a group through the VOL - * * Return: Success: pointer to new group. * * Failure: NULL @@ -1722,7 +1396,7 @@ done: */ void * H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -1731,7 +1405,7 @@ H5VLgroup_create(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, co if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_group_create(obj, loc_params, vol_plugin, name, - gcpl_id, gapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + gcpl_id, gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: @@ -1745,7 +1419,6 @@ done: * Purpose: Opens a group through the VOL * * Return: Success: pointer to new group. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -1755,7 +1428,7 @@ done: */ void * H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, const char *name, - hid_t gapl_id, hid_t dxpl_id, void UNUSED **req) + hid_t gapl_id, hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -1764,7 +1437,7 @@ H5VLgroup_open(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, cons if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") if(NULL == (ret_value = H5VL_group_open(obj, loc_params, vol_plugin, name, - gapl_id, dxpl_id, H5_EVENT_STACK_NULL))) + gapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") done: @@ -1778,7 +1451,6 @@ done: * Purpose: Get specific information about the group through the VOL * * Return: Success: non negative - * * Failure: negative * * Programmer: Mohamad Chaarawi @@ -1787,39 +1459,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLgroup_get(void *obj, H5VL_t *vol_plugin, H5VL_group_get_t get_type, + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*x*xVgi**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*xVii**xx", obj, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Gget_create_plist */ - case H5VL_GROUP_GET_GCPL: - { - hid_t *new_gcpl_id = va_arg (arguments, hid_t *); - - if((ret_value = H5VL_group_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, new_gcpl_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get group information") - break; - } - /* H5Gget_info */ - case H5VL_GROUP_GET_INFO: - { - H5VL_loc_params_t loc_params = va_arg (arguments, H5VL_loc_params_t); - H5G_info_t *grp_info = va_arg (arguments, H5G_info_t *); - - if((ret_value = H5VL_group_get(obj, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, loc_params, grp_info)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get group information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from group") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->group_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group get' method") + if((ret_value = (vol_plugin->cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "Unable to execute group get callback") done: FUNC_LEAVE_API(ret_value) @@ -1827,12 +1482,82 @@ done: /*------------------------------------------------------------------------- + * Function: H5VLgroup_specific + * + * Purpose: specific operation on groups through the VOL + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_specific(void *obj, H5VL_t *vol_plugin, H5VL_group_specific_t specific_type, + hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE6("e", "*x*xVji**xx", obj, vol_plugin, specific_type, dxpl_id, req, + arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->group_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group specific' method") + if((ret_value = (vol_plugin->cls->group_cls.specific) + (obj, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLgroup_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + if(NULL == vol_plugin->cls->group_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `group optional' method") + if((ret_value = (vol_plugin->cls->group_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute group optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_optional() */ + + +/*------------------------------------------------------------------------- * Function: H5VLgroup_close * * Purpose: Closes a group through the VOL * * Return: Success: Non Negative - * * Failure: Negative * * Programmer: Mohamad Chaarawi @@ -1841,7 +1566,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -1850,7 +1575,7 @@ H5VLgroup_close(void *grp, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) if(NULL == grp || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_group_close(grp, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_group_close(grp, vol_plugin, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close group") done: @@ -1872,17 +1597,17 @@ done: */ herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, H5VL_loc_params_t loc_params, - H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void UNUSED **req) + H5VL_t *vol_plugin, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "Vc*xx*xiii**x", create_type, obj, loc_params, vol_plugin, + H5TRACE8("e", "Vk*xx*xiii**x", create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, dxpl_id, req); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_create(create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + if((ret_value = H5VL_link_create(create_type, obj, loc_params, vol_plugin, lcpl_id, lapl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to create link") done: @@ -1891,9 +1616,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLlink_move + * Function: H5VLlink_copy * - * Purpose: Copy or move a link from src to dst. + * Purpose: Copy a link from src to dst. * * Return: Non-negative on success/Negative on failure * @@ -1902,9 +1627,9 @@ done: * *------------------------------------------------------------------------- */ -H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, - H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, - hbool_t copy_flag, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void UNUSED **req) +H5_DLL herr_t H5VLlink_copy(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1912,45 +1637,44 @@ H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void * if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, - copy_flag, lcpl_id, lapl_id, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") + if((ret_value = H5VL_link_copy(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, + lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to copy object") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_move() */ +} /* end H5VLlink_copy() */ /*------------------------------------------------------------------------- - * Function: H5VLlink_iterate + * Function: H5VLlink_move * - * Purpose: Iterate over links in a group + * Purpose: Move a link from src to dst. * - * Return: Success: non negative - * Failure: negative + * Return: Non-negative on success/Negative on failure * * Programmer: Mohamad Chaarawi - * May, 2012 + * April, 2012 * *------------------------------------------------------------------------- */ -herr_t H5VLlink_iterate(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, - hbool_t recursive, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx, - H5L_iterate_t op, void *op_data, hid_t dxpl_id, void UNUSED **req) +H5_DLL herr_t H5VLlink_move(void *src_obj, H5VL_loc_params_t loc_params1, void *dst_obj, + H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin, + hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if(NULL == src_obj || NULL == dst_obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_iterate(obj, loc_params, vol_plugin, recursive, idx_type, order, idx, - op, op_data, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Link iteration failed") + if((ret_value = H5VL_link_move(src_obj, loc_params1, dst_obj, loc_params2, vol_plugin, + lcpl_id, lapl_id, dxpl_id, req)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_iterate() */ + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_move() */ /*------------------------------------------------------------------------- @@ -1969,7 +1693,7 @@ done: */ herr_t H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_link_get_t get_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; @@ -1980,50 +1704,11 @@ H5VLlink_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_l if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Lexists */ - case H5VL_LINK_EXISTS: - { - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - /* H5Lget_info/H5Lget_info_by_idx */ - case H5VL_LINK_GET_INFO: - { - H5L_info_t *linfo = va_arg (arguments, H5L_info_t *); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, linfo)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - /* H5Lget_name_by_idx */ - case H5VL_LINK_GET_NAME: - { - char *name = va_arg (arguments, char *); - size_t size = va_arg (arguments, size_t); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - name, size, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - /* H5Lget_val/H5Lget_val_by_idx */ - case H5VL_LINK_GET_VAL: - { - void *buf = va_arg (arguments, void *); - size_t size = va_arg (arguments, size_t); - - if((ret_value = H5VL_link_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, buf, size)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to get link information") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from link") - } + if(NULL == vol_plugin->cls->link_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link get' method") + if((ret_value = (vol_plugin->cls->link_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link get callback") done: FUNC_LEAVE_API(ret_value) @@ -2031,31 +1716,76 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLlink_remove + * Function: H5VLlink_specific * - * Purpose: Removes a link through the VOL. + * Purpose: specific operation on links through the VOL * - * Return: Non-negative on success/Negative on failure + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi - * April, 2012 + * March, 2012 * *------------------------------------------------------------------------- */ -H5_DLL herr_t H5VLlink_remove(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +herr_t +H5VLlink_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*xx*xVmi**xx", obj, loc_params, vol_plugin, specific_type, + dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") + + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->link_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link specific' method") + if((ret_value = (vol_plugin->cls->link_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link specific callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_specific() */ + + +/*------------------------------------------------------------------------- + * Function: H5VLlink_optional + * + * Purpose: optional operation specific to plugins. + * + * Return: Success: non negative + * Failure: negative + * + * Programmer: Mohamad Chaarawi + * March, 2012 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) +{ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_API(FAIL) + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); + + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_link_remove(obj, loc_params, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to remove link") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == vol_plugin->cls->link_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `link optional' method") + if((ret_value = (vol_plugin->cls->link_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute link optional callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLlink_remove() */ +} /* end H5VLlink_optional() */ /*------------------------------------------------------------------------- @@ -2064,7 +1794,6 @@ done: * Purpose: Opens a object through the VOL * * Return: Success: User ID of the new object. - * * Failure: NULL * * Programmer: Mohamad Chaarawi @@ -2074,7 +1803,7 @@ done: */ void * H5VLobject_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_type_t *opened_type, - hid_t dxpl_id, void UNUSED **req) + hid_t dxpl_id, void **req) { void *ret_value; /* Return value */ @@ -2082,7 +1811,7 @@ H5VLobject_open(void *obj, H5VL_loc_params_t params, H5VL_t *vol_plugin, H5I_typ if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, NULL, "invalid object/VOL class pointer") - if(NULL == (ret_value = H5VL_object_open(obj, params, vol_plugin, opened_type, dxpl_id, H5_EVENT_STACK_NULL))) + if(NULL == (ret_value = H5VL_object_open(obj, params, vol_plugin, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to create group") done: @@ -2106,7 +1835,7 @@ done: herr_t H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin1, const char *src_name, void *dst_obj, H5VL_loc_params_t loc_params2, H5VL_t *vol_plugin2, const char *dst_name, - hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void UNUSED **req) + hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; @@ -2120,7 +1849,7 @@ H5VLobject_copy(void *src_obj, H5VL_loc_params_t loc_params1, H5VL_t *vol_plugin HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") if((ret_value = H5VL_object_copy(src_obj, loc_params1, vol_plugin1, src_name, dst_obj, loc_params2, vol_plugin2, dst_name, - ocpypl_id, lcpl_id, dxpl_id, H5_EVENT_STACK_NULL)) < 0) + ocpypl_id, lcpl_id, dxpl_id, req)) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to move object") done: @@ -2129,37 +1858,6 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLobject_visit - * - * Purpose: Iterate over links in a group - * - * Return: Success: non negative - * Failure: negative - * - * Programmer: Mohamad Chaarawi - * May, 2012 - * - *------------------------------------------------------------------------- - */ -herr_t H5VLobject_visit(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5_index_t idx_type, - H5_iter_order_t order, H5O_iterate_t op, void *op_data, hid_t dxpl_id, void UNUSED **req) -{ - herr_t ret_value = SUCCEED; - - FUNC_ENTER_API(FAIL) - - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_object_visit(obj, loc_params, vol_plugin, idx_type, order, - op, op_data, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - -done: - FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_visit() */ - - -/*------------------------------------------------------------------------- * Function: H5VLobject_get * * Purpose: Get specific information about the object through the VOL @@ -2175,89 +1873,22 @@ done: */ herr_t H5VLobject_get(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_get_t get_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) + hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVoi**xx", obj, loc_params, vol_plugin, get_type, dxpl_id, + H5TRACE7("e", "*xx*xVni**xx", obj, loc_params, vol_plugin, get_type, dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (get_type) { - /* H5Oexists_by_name */ - case H5VL_OBJECT_EXISTS: - { - htri_t *ret = va_arg (arguments, htri_t *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oget_info / H5Oget_info_by_name / H5Oget_info_by_idx */ - case H5VL_OBJECT_GET_INFO: - { - H5O_info_t *obj_info = va_arg (arguments, H5O_info_t *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, obj_info)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oget_comment / H5Oget_comment_by_name */ - case H5VL_OBJECT_GET_COMMENT: - { - char *comment = va_arg (arguments, char *); - size_t bufsize = va_arg (arguments, size_t); - ssize_t *ret = va_arg (arguments, ssize_t *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - comment, bufsize, ret)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Rget_region */ - case H5VL_REF_GET_REGION: - { - hid_t *ret = va_arg (arguments, hid_t *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - ret, ref_type, ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Rget_obj_type2 */ - case H5VL_REF_GET_TYPE: - { - H5O_type_t *obj_type = va_arg (arguments, H5O_type_t *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - obj_type, ref_type, ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Rget_name */ - case H5VL_REF_GET_NAME: - { - ssize_t *ret = va_arg (arguments, ssize_t *); - char *name = va_arg (arguments, char *); - size_t size = va_arg (arguments, size_t); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - void *ref = va_arg (arguments, void *); - - if((ret_value = H5VL_object_get(obj, loc_params, vol_plugin, get_type, dxpl_id, H5_EVENT_STACK_NULL, - ret, name, size, ref_type, ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get this type of information from object") - } + if(NULL == vol_plugin->cls->object_cls.get) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object get' method") + if((ret_value = (vol_plugin->cls->object_cls.get) + (obj, loc_params, get_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object get callback") done: FUNC_LEAVE_API(ret_value) @@ -2265,9 +1896,9 @@ done: /*------------------------------------------------------------------------- - * Function: H5VLobject_misc + * Function: H5VLobject_specific * - * Purpose: perform a plugin specific operation + * Purpose: specific operation on objects through the VOL * * Return: Success: non negative * Failure: negative @@ -2278,77 +1909,37 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_misc(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, H5VL_object_misc_t misc_type, - hid_t dxpl_id, void UNUSED **req, va_list arguments) +H5VLobject_specific(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, + H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) { herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*xx*xVxi**xx", obj, loc_params, vol_plugin, misc_type, dxpl_id, - req, arguments); + H5TRACE7("e", "*xx*xVoi**xx", obj, loc_params, vol_plugin, specific_type, + dxpl_id, req, arguments); if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - switch (misc_type) { - /* H5Arename/rename_by_name */ - case H5VL_ATTR_RENAME: - { - const char *old_name = va_arg (arguments, const char *); - const char *new_name = va_arg (arguments, const char *); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, - old_name, new_name)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oincr_refcount / H5Odecr_refcount */ - case H5VL_OBJECT_CHANGE_REF_COUNT: - { - int update_ref = va_arg (arguments, int); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, update_ref)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - /* H5Oset_comment */ - case H5VL_OBJECT_SET_COMMENT: - { - const char *comment = va_arg (arguments, char *); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, comment)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - case H5VL_REF_CREATE: - { - void *ref = va_arg (arguments, void *); - const char *name = va_arg (arguments, char *); - H5R_type_t ref_type = va_arg (arguments, H5R_type_t); - hid_t space_id = va_arg (arguments, hid_t); - - if((ret_value = H5VL_object_misc(obj, loc_params, vol_plugin, misc_type, dxpl_id, H5_EVENT_STACK_NULL, - ref, name, ref_type, space_id)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "Object Visit Failed") - break; - } - default: - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't recognize this operation type") - } + /* Bypass the H5VLint layer */ + if(NULL == vol_plugin->cls->object_cls.specific) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object specific' method") + if((ret_value = (vol_plugin->cls->object_cls.specific) + (obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object specific callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_misc() */ +} /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- - * Function: H5VLobject_close - * - * Purpose: Closes a object through the VOL + * Function: H5VLobject_optional * - * Return: Success: Non Negative + * Purpose: optional operation specific to plugins. * - * Failure: Negative + * Return: Success: non negative + * Failure: negative * * Programmer: Mohamad Chaarawi * March, 2012 @@ -2356,21 +1947,25 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_close(void *obj, H5VL_loc_params_t loc_params, H5VL_t *vol_plugin, hid_t dxpl_id, void UNUSED **req) +H5VLobject_optional(void *obj, H5VL_t *vol_plugin, hid_t dxpl_id, void **req, va_list arguments) { - herr_t ret_value = SUCCEED; + herr_t ret_value = SUCCEED; FUNC_ENTER_API(FAIL) - H5TRACE5("e", "*xx*xi**x", obj, loc_params, vol_plugin, dxpl_id, req); + H5TRACE5("e", "*x*xi**xx", obj, vol_plugin, dxpl_id, req, arguments); - if(NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) + if (NULL == obj || NULL == vol_plugin || NULL == vol_plugin->cls) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object/VOL class pointer") - if((ret_value = H5VL_object_close(obj, loc_params, vol_plugin, dxpl_id, H5_EVENT_STACK_NULL)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to close object") + + /* Have to bypass the H5VLint layer due to unknown val_list arguments */ + if(NULL == vol_plugin->cls->object_cls.optional) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "vol plugin has no `object optional' method") + if((ret_value = (vol_plugin->cls->object_cls.optional)(obj, dxpl_id, req, arguments)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "Unable to execute object optional callback") done: FUNC_LEAVE_API(ret_value) -} /* end H5VLobject_close() */ +} /* end H5VLobject_optional() */ /*------------------------------------------------------------------------- |