diff options
Diffstat (limited to 'src/H5VLcallback.c')
-rw-r--r-- | src/H5VLcallback.c | 1687 |
1 files changed, 922 insertions, 765 deletions
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index 02e0ee0..baedbf1 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -29,11 +29,13 @@ #include "H5private.h" /* Generic Functions */ #include "H5Eprivate.h" /* Error handling */ -#include "H5Fprivate.h" /* File access */ +#include "H5ESprivate.h" /* Event Sets */ +#include "H5Fprivate.h" /* File access */ #include "H5Iprivate.h" /* IDs */ #include "H5MMprivate.h" /* Memory management */ #include "H5Pprivate.h" /* Property lists */ #include "H5PLprivate.h" /* Plugins */ +#include "H5Tprivate.h" /* Datatypes */ #include "H5VLpkg.h" /* Virtual Object Layer */ /****************/ @@ -54,6 +56,10 @@ typedef struct H5VL_file_open_find_connector_t { hid_t fapl_id; } H5VL_file_open_find_connector_t; +/* Typedef for common callback form of registered optional operations */ +typedef herr_t (*H5VL_reg_opt_oper_t)(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, + hid_t dxpl_id, void **req); + /********************/ /* Package Typedefs */ /********************/ @@ -70,13 +76,12 @@ static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type void **req); static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req); -static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, - void **req, va_list arguments); +static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, hid_t dxpl_id, + void **req); static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, - va_list arguments); -static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, - hid_t dxpl_id, void **req, va_list arguments); + H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, + hid_t dxpl_id, void **req); static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void * H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id, @@ -87,26 +92,24 @@ static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_ hid_t file_space_id, hid_t dxpl_id, void *buf, void **req); static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req); -static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, - H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req, - va_list arguments); -static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, - hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args, + hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args, + hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, + hid_t dxpl_id, void **req); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req); static void * H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, - H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req, - va_list arguments); -static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type, - hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t *args, + hid_t dxpl_id, void **req); +static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_args_t *args, + hid_t dxpl_id, void **req); +static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, + hid_t dxpl_id, void **req); static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); @@ -114,28 +117,28 @@ static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigne hid_t dxpl_id, void **req); static herr_t H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info, void *op_data); -static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, - void **req, va_list arguments); -static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type, - hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, hid_t dxpl_id, + void **req); +static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_t *args, + hid_t dxpl_id, void **req); +static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, + hid_t dxpl_id, void **req); static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); static void * H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req); static void * H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req); -static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, - void **req, va_list arguments); -static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments); -static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type, - hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, hid_t dxpl_id, + void **req); +static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_args_t *args, + hid_t dxpl_id, void **req); +static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, + hid_t dxpl_id, void **req); static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); -static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, - const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id, - hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments); +static herr_t H5VL__link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, + void **req); static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); @@ -143,12 +146,11 @@ static herr_t H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + H5VL_link_get_args_t *args, hid_t dxpl_id, void **req); static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, - va_list arguments); -static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type, - hid_t dxpl_id, void **req, va_list arguments); + H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req); static void * H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req); static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, @@ -156,12 +158,11 @@ static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_ const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments); + H5VL_object_get_args_t *args, hid_t dxpl_id, void **req); static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, - va_list arguments); -static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type, - hid_t dxpl_id, void **req, va_list arguments); + H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req); static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, H5VL_get_conn_lvl_t lvl, const H5VL_class_t **conn_cls); static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls, @@ -170,27 +171,25 @@ static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t ti H5VL_request_status_t *status); static herr_t H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb, void *ctx); static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls, H5VL_request_status_t *status); -static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, - H5VL_request_specific_t specific_type, va_list arguments); -static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type, - va_list arguments); +static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_args_t *args); +static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t *args); static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls); static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, void *blob_id, void *ctx); static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, void *buf, size_t size, void *ctx); static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, - H5VL_blob_specific_t specific_type, va_list arguments); + H5VL_blob_specific_args_t *args); static herr_t H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, - H5VL_blob_optional_t opt_type, va_list arguments); + H5VL_optional_args_t *args); static herr_t H5VL__token_cmp(void *obj, const H5VL_class_t *cls, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value); static herr_t H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, const H5O_token_t *token, char **token_str); static herr_t H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls, const char *token_str, H5O_token_t *token); -static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req, - va_list arguments); +static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req); /*********************/ /* Package Variables */ @@ -329,6 +328,50 @@ done: } /* H5VLget_value */ /*------------------------------------------------------------------------- + * Function: H5VL__common_optional_op + * + * Purpose: Performs an optional connector-specific operation on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__common_optional_op(hid_t id, H5I_type_t id_type, H5VL_reg_opt_oper_t reg_opt_op, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req, H5VL_object_t **_vol_obj_ptr) +{ + H5VL_object_t * tmp_vol_obj = NULL; /* Object for id */ + H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for id */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check ID type & get VOL object */ + if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(id, id_type))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid identifier") + + /* Set wrapper info in API context */ + if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + /* (Must return value from callback, for iterators) */ + if ((ret_value = + (*reg_opt_op)((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); + +done: + /* Reset object wrapping info in API context */ + if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__common_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL_copy_connector_info * * Purpose: Copy the VOL info for a connector @@ -1341,8 +1384,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, - va_list arguments) +H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1353,7 +1395,7 @@ H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method") /* Call the corresponding VOL callback */ - if ((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + if ((cls->attr_cls.get)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") done: @@ -1371,10 +1413,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...) +H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1386,16 +1426,10 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -1414,23 +1448,24 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req /*out*/, - va_list arguments) +H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVaixx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object") if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + if (NULL == args) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument struct") /* Call the corresponding internal VOL routine */ - if (H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__attr_get(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") done: @@ -1449,7 +1484,7 @@ done: */ static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) + H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1460,8 +1495,9 @@ H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method") /* Call the corresponding VOL callback */ - if ((ret_value = (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") + /* (Must return value from callback, for iterators) */ + if ((ret_value = (cls->attr_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1479,10 +1515,8 @@ done: */ herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...) + H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1494,17 +1528,12 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if ((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, - dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = + H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback"); done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -1524,13 +1553,13 @@ done: */ herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, - H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req /*out*/, va_list arguments) + H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*x*#iVbixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1539,8 +1568,9 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -1557,8 +1587,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -1569,8 +1598,9 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->attr_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = (cls->attr_cls.optional)(obj, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1587,11 +1617,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req, - ...) +H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1603,17 +1630,11 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if ((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, - arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback"); done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -1632,14 +1653,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVsixx", obj, connector_id, opt_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -1648,14 +1669,58 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__attr_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = H5VL__attr_optional(obj, cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLattr_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLattr_optional_op + * + * Purpose: Performs an optional connector-specific operation on an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, + H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id) +{ + H5VL_object_t *vol_obj = NULL; /* Attribute VOL object */ + void * token = NULL; /* Request token for async operation */ + void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, attr_id, args, dxpl_id, es_id); + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Call the common VOL connector optional routine */ + if ((ret_value = H5VL__common_optional_op(attr_id, H5I_ATTR, H5VL__attr_optional, args, dxpl_id, + token_ptr, &vol_obj)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback") + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, + H5ARG_TRACE7(FUNC, "*s*sIui*!ii", app_file, app_func, app_line, attr_id, args, dxpl_id, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLattr_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__attr_close * * Purpose: Closes an attribute through the VOL @@ -2169,8 +2234,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, - va_list arguments) +H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2181,7 +2246,7 @@ H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_typ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method") /* Call the corresponding VOL callback */ - if ((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + if ((cls->dataset_cls.get)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") done: @@ -2199,10 +2264,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...) +H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2214,16 +2277,10 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_ vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -2242,14 +2299,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req /*out*/, - va_list arguments) +H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVcixx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2258,7 +2315,7 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, hid_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__dataset_get(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") done: @@ -2276,8 +2333,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) +H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2288,7 +2345,7 @@ H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method") /* Call the corresponding VOL callback */ - if ((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + if ((cls->dataset_cls.specific)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") done: @@ -2306,11 +2363,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, - void **req, ...) +H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, + void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2322,17 +2377,10 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, - arguments) < 0) + if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -2351,14 +2399,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVdixx", obj, connector_id, specific_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2367,7 +2415,7 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t spec HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + if (H5VL__dataset_specific(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") done: @@ -2385,8 +2433,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2397,7 +2445,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method") /* Call the corresponding VOL callback */ - if ((cls->dataset_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) + if ((cls->dataset_cls.optional)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2415,11 +2463,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, - void **req, ...) +H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2431,16 +2476,10 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_ vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -2459,14 +2498,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVtixx", obj, connector_id, opt_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2475,7 +2514,7 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__dataset_optional(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") done: @@ -2483,6 +2522,49 @@ done: } /* end H5VLdataset_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLdataset_optional_op + * + * Purpose: Performs an optional connector-specific operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id, + H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id) +{ + H5VL_object_t *vol_obj = NULL; /* Dataset VOL object */ + void * token = NULL; /* Request token for async operation */ + void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, dset_id, args, dxpl_id, es_id); + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Call the corresponding internal VOL routine */ + if (H5VL__common_optional_op(dset_id, H5I_DATASET, H5VL__dataset_optional, args, dxpl_id, token_ptr, + &vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, + H5ARG_TRACE7(FUNC, "*s*sIui*!ii", app_file, app_func, app_line, dset_id, args, dxpl_id, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdataset_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__dataset_close * * Purpose: Closes a dataset through the VOL @@ -2807,8 +2889,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2819,8 +2901,8 @@ H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_t HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method") /* Call the corresponding VOL callback */ - if ((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") + if ((cls->datatype_cls.get)(obj, args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype 'get' failed") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2837,10 +2919,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...) +H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2852,16 +2932,10 @@ H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hi vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -2880,14 +2954,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVeixx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -2895,12 +2969,8 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, hi if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->datatype_cls.get) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method") - /* Call the corresponding internal VOL routine */ - if (H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__datatype_get(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") done: @@ -2918,8 +2988,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type, - hid_t dxpl_id, void **req, va_list arguments) +H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_args_t *args, + hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -2930,7 +3000,7 @@ H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specif HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method") /* Call the corresponding VOL callback */ - if ((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + if ((cls->datatype_cls.specific)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: @@ -2948,11 +3018,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, - void **req, ...) +H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, + void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -2964,17 +3032,10 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t sp vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, - arguments) < 0) + if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -2993,14 +3054,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVfixx", obj, connector_id, specific_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3009,7 +3070,7 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t sp HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + if (H5VL__datatype_specific(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") done: @@ -3027,8 +3088,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3039,7 +3100,7 @@ H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_option HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method") /* Call the corresponding VOL callback */ - if ((cls->datatype_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) + if ((cls->datatype_cls.optional)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: @@ -3057,11 +3118,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, - void **req, ...) +H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3073,17 +3131,10 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t op vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < - 0) + if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -3092,6 +3143,50 @@ done: } /* end H5VL_datatype_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL_datatype_optional_op + * + * Purpose: Optional operation specific to connectors. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req, + H5VL_object_t **_vol_obj_ptr) +{ + H5VL_object_t * tmp_vol_obj = NULL; /* Object for id */ + H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for id */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(vol_obj); + + /* Set up vol_obj_ptr */ + *vol_obj_ptr = vol_obj; + + /* Set wrapper info in API context */ + if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_optional((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + +done: + /* Reset object wrapping info in API context */ + if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_datatype_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_optional * * Purpose: Performs an optional connector-specific operation on a datatype @@ -3102,14 +3197,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVuixx", obj, connector_id, opt_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3118,7 +3213,7 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t op HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__datatype_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__datatype_optional(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") done: @@ -3126,6 +3221,53 @@ done: } /* end H5VLdatatype_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLdatatype_optional_op + * + * Purpose: Performs an optional connector-specific operation on a datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t type_id, + H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id) +{ + H5T_t * dt; /* Datatype for this operation */ + H5VL_object_t *vol_obj = NULL; /* Datatype VOL object */ + void * token = NULL; /* Request token for async operation */ + void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, type_id, args, dxpl_id, es_id); + + /* Check args */ + if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Only invoke callback if VOL object is set for the datatype */ + if (H5T_invoke_vol_optional(dt, args, dxpl_id, token_ptr, &vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to invoke datatype optional callback") + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, + H5ARG_TRACE7(FUNC, "*s*sIui*!ii", app_file, app_func, app_line, type_id, args, dxpl_id, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLdatatype_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__datatype_close * * Purpose: Closes a datatype through the VOL @@ -3380,14 +3522,15 @@ static herr_t H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info, void *op_data) { H5VL_file_open_find_connector_t *udata = (H5VL_file_open_find_connector_t *)op_data; - const H5VL_class_t * cls = (const H5VL_class_t *)plugin_info; + H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */ + const H5VL_class_t * cls = (const H5VL_class_t *)plugin_info; H5P_genplist_t * fapl_plist; H5P_genplist_t * fapl_plist_copy; + hbool_t is_accessible = FALSE; /* Whether file is accessible */ herr_t status; - htri_t is_accessible = FALSE; - hid_t connector_id = H5I_INVALID_HID; - hid_t fapl_id = H5I_INVALID_HID; - herr_t ret_value = H5_ITER_CONT; + hid_t connector_id = H5I_INVALID_HID; + hid_t fapl_id = H5I_INVALID_HID; + herr_t ret_value = H5_ITER_CONT; FUNC_ENTER_STATIC @@ -3416,11 +3559,16 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in if (H5P_set_vol(fapl_plist_copy, connector_id, NULL) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5_ITER_ERROR, "can't set VOL connector on fapl") + /* Set up VOL callback arguments */ + vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE; + vol_cb_args.args.is_accessible.filename = udata->filename; + vol_cb_args.args.is_accessible.fapl_id = fapl_id; + vol_cb_args.args.is_accessible.accessible = &is_accessible; + /* Check if file is accessible with given VOL connector */ H5E_BEGIN_TRY { - status = H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, - fapl_id, udata->filename, &is_accessible); + status = H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL); } H5E_END_TRY; @@ -3428,7 +3576,7 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in * the FAPL with that VOL connector set on it. Errors are ignored here * as some VOL connectors may not support H5Fis_accessible. */ - if (status == SUCCEED && is_accessible > 0) { + if (status == SUCCEED && is_accessible) { /* Modify 'connector_prop' to point to the VOL connector that * was actually used to open the file, rather than the original * VOL connector that was requested. @@ -3479,21 +3627,18 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned /* Call the corresponding internal VOL routine */ if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) { - H5VL_file_open_find_connector_t find_connector_ud; - hbool_t find_connector; - hbool_t connector_available = FALSE; + hbool_t is_default_conn = TRUE; /* Opening the file failed - Determine whether we should search * the plugin path to see if any other VOL connectors are available - * to attempt to open the file with. This only occurs if no particular - * VOL connector was specified (either via a FAPL or the - * HDF5_VOL_CONNECTOR environment variable). + * to attempt to open the file with. This only occurs if the default + * VOL connector was used for the initial file open attempt. */ - find_connector = !getenv("HDF5_VOL_CONNECTOR") && ((H5P_FILE_ACCESS_DEFAULT == fapl_id) || - connector_prop->connector_id == H5_DEFAULT_VOL); + H5VL__is_default_conn(fapl_id, connector_prop->connector_id, &is_default_conn); - if (find_connector) { - herr_t iter_ret; + if (is_default_conn) { + H5VL_file_open_find_connector_t find_connector_ud; + herr_t iter_ret; find_connector_ud.connector_prop = connector_prop; find_connector_ud.filename = name; @@ -3505,24 +3650,24 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned if (iter_ret < 0) HGOTO_ERROR(H5E_VOL, H5E_BADITER, NULL, "failed to iterate over available VOL connector plugins") - else if (iter_ret) - connector_available = TRUE; + else if (iter_ret) { + /* If one of the available VOL connector plugins is + * able to open the file, clear the error stack from any + * previous file open failures and then open the file. + * Otherwise, if no VOL connectors are available, throw + * error from original file open failure. + */ + H5E_clear_stack(NULL); + + if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags, + find_connector_ud.fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, + "can't open file '%s' with VOL connector '%s'", name, + find_connector_ud.cls->name) + } + else + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") } /* end if */ - - /* If one of the available VOL connector plugins is - * able to open the file, clear the error stack from any - * previous file open failures and then open the file. - * Otherwise, if no VOL connectors are available, throw - * error from original file open failure. - */ - if (connector_available) { - H5E_clear_stack(NULL); - - if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags, - find_connector_ud.fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "can't open file '%s' with VOL connector '%s'", - name, find_connector_ud.cls->name) - } else HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") } /* end if */ @@ -3581,8 +3726,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, - va_list arguments) +H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3593,7 +3737,7 @@ H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method") /* Call the corresponding VOL callback */ - if ((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + if ((cls->file_cls.get)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") done: @@ -3611,10 +3755,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...) +H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3626,16 +3768,10 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__file_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -3654,14 +3790,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req /*out*/, - va_list arguments) +H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVgixx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3670,7 +3805,7 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__file_get(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") done: @@ -3688,8 +3823,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3700,7 +3835,7 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method") /* Call the corresponding VOL callback */ - if ((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + if ((cls->file_cls.specific)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") done: @@ -3718,33 +3853,28 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, - void **req, ...) +H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req) { const H5VL_class_t *cls; /* VOL connector's class struct */ - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Start access to the varargs, so they are available in all situations below */ - HDva_start(arguments, req); - arg_started = TRUE; - /* Special treatment of file access check & delete operations */ /* (Retrieve the VOL connector from the FAPL, since the file isn't open) */ - if (specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) { + if (args->op_type == H5VL_FILE_IS_ACCESSIBLE || args->op_type == H5VL_FILE_DELETE) { H5P_genplist_t * plist; /* Property list pointer */ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - va_list tmp_args; /* argument list passed from the API call */ hid_t fapl_id; /* File access property list for accessing the file */ /* Get the file access property list to access the file */ - HDva_copy(tmp_args, arguments); - fapl_id = HDva_arg(tmp_args, hid_t); - HDva_end(tmp_args); + if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) + fapl_id = args->args.is_accessible.fapl_id; + else { + HDassert(args->op_type == H5VL_FILE_DELETE); + fapl_id = args->args.del.fapl_id; + } /* Get the VOL info from the FAPL */ if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) @@ -3770,14 +3900,10 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t } /* end else */ /* Call the corresponding internal VOL routine */ - if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0) + if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -3798,21 +3924,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVhixx", obj, connector_id, specific_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + if (H5VL__file_specific(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") done: @@ -3830,8 +3956,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -3842,7 +3967,7 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method") /* Call the corresponding VOL callback */ - if ((cls->file_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) + if ((cls->file_cls.optional)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: @@ -3860,11 +3985,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req, - ...) +H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3876,16 +3998,10 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -3904,14 +4020,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVvixx", obj, connector_id, opt_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -3920,7 +4036,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__file_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__file_optional(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") done: @@ -3928,6 +4044,49 @@ done: } /* end H5VLfile_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLfile_optional_op + * + * Purpose: Performs an optional connector-specific operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, + H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id) +{ + H5VL_object_t *vol_obj = NULL; /* File VOL object */ + void * token = NULL; /* Request token for async operation */ + void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, file_id, args, dxpl_id, es_id); + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Call the corresponding internal VOL routine */ + if (H5VL__common_optional_op(file_id, H5I_FILE, H5VL__file_optional, args, dxpl_id, token_ptr, &vol_obj) < + 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, + H5ARG_TRACE7(FUNC, "*s*sIui*!ii", app_file, app_func, app_line, file_id, args, dxpl_id, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLfile_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__file_close * * Purpose: Closes a file through the VOL @@ -4244,8 +4403,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, - va_list arguments) +H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4256,7 +4414,7 @@ H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, h HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method") /* Call the corresponding VOL callback */ - if ((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0) + if ((cls->group_cls.get)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") done: @@ -4274,10 +4432,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...) +H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4289,16 +4445,10 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dx vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__group_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -4317,14 +4467,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req /*out*/, - va_list arguments) +H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiViixx", obj, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4333,7 +4482,7 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dx HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__group_get(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") done: @@ -4351,8 +4500,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4363,7 +4512,7 @@ H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t s HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method") /* Call the corresponding VOL callback */ - if ((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0) + if ((cls->group_cls.specific)(obj, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: @@ -4381,11 +4530,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, - void **req, ...) +H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4397,17 +4543,10 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) < - 0) + if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -4426,14 +4565,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVjixx", obj, connector_id, specific_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4442,7 +4581,7 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0) + if (H5VL__group_specific(obj, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") done: @@ -4460,8 +4599,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4472,8 +4611,9 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t o HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->group_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = (cls->group_cls.optional)(obj, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4490,11 +4630,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req, - ...) +H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -4506,17 +4643,11 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if ((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, - arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback"); done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -4535,14 +4666,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, + void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVwixx", obj, connector_id, opt_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -4551,14 +4682,58 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__group_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = H5VL__group_optional(obj, cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) } /* end H5VLgroup_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLgroup_optional_op + * + * Purpose: Performs an optional connector-specific operation on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id, + H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id) +{ + H5VL_object_t *vol_obj = NULL; /* Group VOL object */ + void * token = NULL; /* Request token for async operation */ + void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, group_id, args, dxpl_id, es_id); + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Call the corresponding internal VOL routine */ + if ((ret_value = H5VL__common_optional_op(group_id, H5I_GROUP, H5VL__group_optional, args, dxpl_id, + token_ptr, &vol_obj)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback") + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, + H5ARG_TRACE7(FUNC, "*s*sIui*!ii", app_file, app_func, app_line, group_id, args, dxpl_id, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLgroup_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__group_close * * Purpose: Closes a group through the VOL @@ -4672,9 +4847,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, - const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, - va_list arguments) +H5VL__link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params, + const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -4685,7 +4859,7 @@ H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method") /* Call the corresponding VOL callback */ - if ((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0) + if ((cls->link_cls.create)(args, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") done: @@ -4703,31 +4877,19 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj, - const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, - ...) +H5VL_link_create(H5VL_link_create_args_t *args, const H5VL_object_t *vol_obj, + const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { - H5VL_object_t tmp_vol_obj; /* Temporary object */ - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ + H5VL_object_t tmp_vol_obj; /* Temporary VOL object */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) - /* Start the varargs, so they can be copied */ - HDva_start(arguments, req); - arg_started = TRUE; - /* Special case for hard links */ - if (H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) { - va_list tmp_arguments; /* Copy of argument list passed in */ - - /* Get the VOL data pointer from the varargs */ - HDva_copy(tmp_arguments, arguments); - tmp_vol_obj.data = HDva_arg(tmp_arguments, void *); - HDva_end(tmp_arguments); - } /* end if */ + if (H5VL_LINK_CREATE_HARD == args->op_type && NULL == vol_obj->data) + /* Get the VOL data pointer from the arguments */ + tmp_vol_obj.data = args->args.hard.curr_obj; else /* Use the VOL object passed in */ tmp_vol_obj.data = vol_obj->data; @@ -4739,15 +4901,11 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if (H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, - dxpl_id, req, arguments) < 0) + if (H5VL__link_create(args, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, + req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -4768,23 +4926,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params, - hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/, - va_list arguments) +H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params, + hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE9("e", "Vk*x*#iiiixx", create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req, - arguments); + H5TRACE8("e", "*!*x*#iiiix", args, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0) + if (H5VL__link_create(args, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") done: @@ -5017,7 +5173,7 @@ done: */ static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) + H5VL_link_get_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5028,7 +5184,7 @@ H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method") /* Call the corresponding VOL callback */ - if ((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + if ((cls->link_cls.get)(obj, loc_params, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") done: @@ -5046,11 +5202,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args, + hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5062,17 +5216,10 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, - arguments) < 0) + if (H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -5091,14 +5238,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type, - hid_t dxpl_id, void **req /*out*/, va_list arguments) +H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_args_t *args, + hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*x*#iVlixx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5107,7 +5254,7 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__link_get(obj, loc_params, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") done: @@ -5126,7 +5273,7 @@ done: */ static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) + H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5137,8 +5284,9 @@ H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method") /* Call the corresponding VOL callback */ - if ((ret_value = (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") + /* (Must return value from callback, for iterators) */ + if ((ret_value = (cls->link_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5156,10 +5304,8 @@ done: */ herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...) + H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5171,17 +5317,12 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if ((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, - dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = + H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback"); done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -5201,13 +5342,13 @@ done: */ herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, - H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req /*out*/, va_list arguments) + H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*x*#iVmixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5216,8 +5357,9 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback") + /* (Must return value from callback, for iterators) */ + if ((ret_value = H5VL__link_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5234,8 +5376,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5246,7 +5388,7 @@ H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method") /* Call the corresponding VOL callback */ - if ((cls->link_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) + if ((cls->link_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -5264,11 +5406,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req, - ...) +H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5280,16 +5420,10 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__link_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -5308,14 +5442,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVxixx", obj, connector_id, opt_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5324,7 +5458,7 @@ H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__link_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__link_optional(obj, loc_params, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") done: @@ -5332,6 +5466,67 @@ done: } /* end H5VLlink_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLlink_optional_op + * + * Purpose: Performs an optional connector-specific operation on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, + const char *name, hid_t lapl_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id) +{ + H5VL_object_t * vol_obj = NULL; /* Object for loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters for object access */ + void * token = NULL; /* Request token for async operation */ + void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, + es_id); + + /* Check arguments */ + /* name is verified in H5VL_setup_name_args() */ + + /* Set up object access arguments */ + if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments") + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Set wrapper info in API context */ + if (H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) < + 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(FUNC, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + +done: + /* Reset object wrapping info in API context */ + if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_API(ret_value) +} /* end H5VLlink_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__object_open * * Purpose: Opens a object through the VOL @@ -5556,7 +5751,7 @@ done: */ static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments) + H5VL_object_get_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5567,7 +5762,7 @@ H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_clas HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method") /* Call the corresponding VOL callback */ - if ((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0) + if ((cls->object_cls.get)(obj, loc_params, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") done: @@ -5585,11 +5780,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, - hid_t dxpl_id, void **req, ...) +H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + H5VL_object_get_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5601,17 +5794,10 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req, - arguments) < 0) + if (H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -5630,14 +5816,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type, - hid_t dxpl_id, void **req /*out*/, va_list arguments) +H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + H5VL_object_get_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*x*#iVnixx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5646,7 +5832,7 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0) + if (H5VL__object_get(obj, loc_params, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") done: @@ -5665,7 +5851,7 @@ done: */ static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments) + H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5676,8 +5862,9 @@ H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + /* (Must return value from callback, for iterators) */ + if ((ret_value = (cls->object_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "object specific failed"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5695,10 +5882,8 @@ done: */ herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...) + H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5710,17 +5895,12 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if ((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type, - dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed") + /* (Must return value from callback, for iterators) */ + if ((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, + req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "object specific failed"); done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -5740,14 +5920,13 @@ done: */ herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, - H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req /*out*/, - va_list arguments) + H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE7("e", "*x*#iVoixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5755,13 +5934,10 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") - /* Check if the corresponding VOL callback exists */ - if (NULL == cls->object_cls.specific) - HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `object specific' method") - /* Bypass the H5VLint layer, calling the VOL callback directly */ - if ((ret_value = (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") + /* (Must return value from callback, for iterators) */ + if ((ret_value = (cls->object_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute object specific callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) @@ -5778,8 +5954,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type, hid_t dxpl_id, - void **req, va_list arguments) +H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -5790,7 +5966,7 @@ H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method") /* Call the corresponding VOL callback */ - if ((cls->object_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0) + if ((cls->object_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5808,11 +5984,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req, - ...) +H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -5824,16 +5998,10 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_ty vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if (H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__object_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") @@ -5852,14 +6020,14 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, hid_t dxpl_id, - void **req /*out*/, va_list arguments) +H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, + H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiVyixx", obj, connector_id, opt_type, dxpl_id, req, arguments); + H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5868,7 +6036,7 @@ H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_ty HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (H5VL__object_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0) + if (H5VL__object_optional(obj, loc_params, cls, args, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") done: @@ -5876,6 +6044,68 @@ done: } /* end H5VLobject_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLobject_optional_op + * + * Purpose: Performs an optional connector-specific operation on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id, + const char *name, hid_t lapl_id, H5VL_optional_args_t *args, hid_t dxpl_id, + hid_t es_id) +{ + H5VL_object_t * vol_obj = NULL; /* Object for loc_id */ + H5VL_loc_params_t loc_params; /* Location parameters for object access */ + void * token = NULL; /* Request token for async operation */ + void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE9("e", "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, + es_id); + + /* Check arguments */ + /* name is verified in H5VL_setup_name_args() */ + + /* Set up object access arguments */ + if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments") + + /* Set up request token pointer for asynchronous operation */ + if (H5ES_NONE != es_id) + token_ptr = &token; /* Point at token for VOL connector to set up */ + + /* Set wrapper info in API context */ + if (H5VL_set_vol_wrapper(vol_obj) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") + vol_wrapper_set = TRUE; + + /* Call the corresponding internal VOL routine */ + if (H5VL__object_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) < + 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback") + + /* If a token was created, add the token to the event set */ + if (NULL != token) + /* clang-format off */ + if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(FUNC, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0) + /* clang-format on */ + HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set") + +done: + /* Reset object wrapping info in API context */ + if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") + + FUNC_LEAVE_API(ret_value) +} /* end H5VLobject_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__introspect_get_conn_cls * * Purpose: Calls the connector-specific callback to query the connector @@ -5989,6 +6219,76 @@ done: } /* end H5VLintrospect_get_conn_cls() */ /*------------------------------------------------------------------------- + * Function: H5VL_introspect_get_cap_flags + * + * Purpose: Calls the connector-specific callback to query the connector's + * capability flags. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigned *cap_flags) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(cls); + HDassert(cap_flags); + + /* Check if the corresponding VOL callback exists */ + if (NULL == cls->introspect_cls.get_cap_flags) + HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_cap_flags' method") + + /* Call the corresponding VOL callback */ + if ((cls->introspect_cls.get_cap_flags)(info, cap_flags) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector capability flags") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_introspect_get_cap_flags() */ + +/*------------------------------------------------------------------------- + * Function: H5VLintrospect_get_cap_flags + * + * Purpose: Calls the connector-specific callback to query the connector's + * capability flags. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap_flags /*out*/) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API_NOINIT + H5TRACE3("e", "*xix", info, connector_id, cap_flags); + + /* Check args */ + if (NULL == cap_flags) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer") + + /* Get class pointer */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if (H5VL_introspect_get_cap_flags(info, cls, cap_flags) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags") + +done: + FUNC_LEAVE_API_NOINIT(ret_value) +} /* end H5VLintrospect_get_cap_flags() */ + +/*------------------------------------------------------------------------- * Function: H5VL__introspect_opt_query * * Purpose: Calls the connector-specific callback to query if an optional @@ -6135,28 +6435,18 @@ done: herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5VL_request_status_t *status) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity checks */ HDassert(vol_obj); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ if (H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_wait() */ @@ -6239,28 +6529,18 @@ done: herr_t H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(vol_obj); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ if (H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_notify() */ @@ -6342,28 +6622,18 @@ done: herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj, H5VL_request_status_t *status) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(vol_obj); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ if (H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls, status) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_cancel() */ @@ -6378,13 +6648,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status) +H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE3("e", "*xi*#", req, connector_id, status); + H5TRACE3("e", "*xix", req, connector_id, status); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) @@ -6409,8 +6679,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_t specific_type, - va_list arguments) +H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_args_t *args) { herr_t ret_value = SUCCEED; /* Return value */ @@ -6425,7 +6694,7 @@ H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0) + if ((cls->request_cls.specific)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") @@ -6444,40 +6713,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...) +H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t *args) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(vol_obj); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ - HDva_start(arguments, specific_type); - arg_started = TRUE; - if ((ret_value = - H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0) + if (H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_specific() */ @@ -6492,20 +6742,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments) +H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t *args) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments); + H5TRACE3("e", "*xi*!", req, connector_id, args); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0) + if (H5VL__request_specific(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request specific callback") @@ -6524,8 +6774,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type, - va_list arguments) +H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t *args) { herr_t ret_value = SUCCEED; /* Return value */ @@ -6540,7 +6789,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->request_cls.optional)(req, opt_type, arguments)) < 0) + if ((cls->request_cls.optional)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") @@ -6559,39 +6808,21 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...) +H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(vol_obj); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ - HDva_start(arguments, opt_type); - arg_started = TRUE; - if ((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, opt_type, arguments)) < 0) + if (H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_optional() */ @@ -6606,20 +6837,20 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, va_list arguments) +H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE4("e", "*xiVzx", req, connector_id, opt_type, arguments); + H5TRACE3("e", "*xi*!", req, connector_id, args); /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__request_optional(req, cls, opt_type, arguments)) < 0) + if (H5VL__request_optional(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute asynchronous request optional callback") @@ -6628,6 +6859,43 @@ done: } /* end H5VLrequest_optional() */ /*------------------------------------------------------------------------- + * Function: H5VLrequest_optional_op + * + * Purpose: Performs an optional connector-specific operation on a request + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +herr_t +H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *args) +{ + H5VL_class_t *cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE3("e", "*xi*!", req, connector_id, args); + + /* Check arguments */ + if (NULL == req) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request") + if (NULL == args) + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments") + + /* Get class pointer */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Call the corresponding internal VOL routine */ + if (H5VL__request_optional(req, cls, args) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request optional callback") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5VLrequest_optional_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL__request_free * * Purpose: Frees an asynchronous request through the VOL @@ -6673,28 +6941,18 @@ done: herr_t H5VL_request_free(const H5VL_object_t *vol_obj) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) /* Sanity check */ HDassert(vol_obj); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ if (H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_request_free() */ @@ -6778,8 +7036,7 @@ done: herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -6788,19 +7045,11 @@ H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void * HDassert(size == 0 || buf); HDassert(blob_id); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ if (H5VL__blob_put(vol_obj->data, vol_obj->connector->cls, buf, size, blob_id, ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_blob_put() */ @@ -6882,8 +7131,7 @@ done: herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -6892,19 +7140,11 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size HDassert(blob_id); HDassert(buf); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding VOL callback */ if (H5VL__blob_get(vol_obj->data, vol_obj->connector->cls, blob_id, buf, size, ctx) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_blob_get() */ @@ -6953,8 +7193,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_t specific_type, - va_list arguments) +H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_args_t *args) { herr_t ret_value = SUCCEED; /* Return value */ @@ -6970,7 +7209,7 @@ H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob specific' method") /* Call the corresponding VOL callback */ - if ((cls->blob_cls.specific)(obj, blob_id, specific_type, arguments) < 0) + if ((cls->blob_cls.specific)(obj, blob_id, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") done: @@ -6988,12 +7227,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...) +H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_args_t *args) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -7001,27 +7237,11 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specif HDassert(vol_obj); HDassert(blob_id); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ - HDva_start(arguments, specific_type); - arg_started = TRUE; - if ((ret_value = H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, specific_type, - arguments)) < 0) + if (H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_blob_specific() */ @@ -7035,14 +7255,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type, - va_list arguments) +H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_args_t *args) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*xVBx", obj, connector_id, blob_id, specific_type, arguments); + H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args); /* Get class pointer */ if (NULL == obj) @@ -7051,7 +7270,7 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding VOL callback */ - if (H5VL__blob_specific(obj, cls, blob_id, specific_type, arguments) < 0) + if (H5VL__blob_specific(obj, cls, blob_id, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed") done: @@ -7071,8 +7290,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_optional_t opt_type, - va_list arguments) +H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_optional_args_t *args) { herr_t ret_value = SUCCEED; /* Return value */ @@ -7088,7 +7306,7 @@ H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob optional' method") /* Call the corresponding VOL callback */ - if ((cls->blob_cls.optional)(obj, blob_id, opt_type, arguments) < 0) + if ((cls->blob_cls.optional)(obj, blob_id, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") done: @@ -7106,12 +7324,9 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type, ...) +H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_args_t *args) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -7119,27 +7334,11 @@ H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_option HDassert(vol_obj); HDassert(blob_id); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ - HDva_start(arguments, opt_type); - arg_started = TRUE; - if ((ret_value = - H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, opt_type, arguments)) < 0) + if (H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_blob_optional() */ @@ -7153,14 +7352,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type, - va_list arguments) +H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_args_t *args) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE5("e", "*xi*xVAx", obj, connector_id, blob_id, opt_type, arguments); + H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args); /* Get class pointer */ if (NULL == obj) @@ -7169,7 +7367,7 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_option HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding VOL callback */ - if (H5VL__blob_optional(obj, cls, blob_id, opt_type, arguments) < 0) + if (H5VL__blob_optional(obj, cls, blob_id, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed") done: @@ -7243,8 +7441,7 @@ herr_t H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, const H5O_token_t *token2, int *cmp_value) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -7252,20 +7449,11 @@ H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, const H5 HDassert(vol_obj); HDassert(cmp_value); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value)) < 0) + if (H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_token_cmp() */ @@ -7362,8 +7550,7 @@ herr_t H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const H5O_token_t *token, char **token_str) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -7372,21 +7559,11 @@ H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const H5O_t HDassert(token); HDassert(token_str); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str)) < - 0) + if (H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_token_to_str() */ @@ -7480,8 +7657,7 @@ herr_t H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const char *token_str, H5O_token_t *token) { - hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ - herr_t ret_value = SUCCEED; /* Return value */ + herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(FAIL) @@ -7490,21 +7666,11 @@ H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const cha HDassert(token); HDassert(token_str); - /* Set wrapper info in API context */ - if (H5VL_set_vol_wrapper(vol_obj) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info") - vol_wrapper_set = TRUE; - /* Call the corresponding internal VOL routine */ - if ((ret_value = - H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token)) < 0) + if (H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization failed") done: - /* Reset object wrapping info in API context */ - if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") - FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_token_from_str() */ @@ -7557,7 +7723,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req, va_list arguments) +H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { herr_t ret_value = SUCCEED; /* Return value */ @@ -7568,8 +7734,8 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, v HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method") /* Call the corresponding VOL callback */ - if ((ret_value = (cls->optional)(obj, op_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") + if ((ret_value = (cls->optional)(obj, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7586,10 +7752,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...) +H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req) { - va_list arguments; /* Argument list passed from the API call */ - hbool_t arg_started = FALSE; /* Whether the va_list has been started */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -7601,20 +7765,13 @@ H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **r vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - HDva_start(arguments, req); - arg_started = TRUE; - if ((ret_value = - H5VL__optional(vol_obj->data, vol_obj->connector->cls, op_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback") + if ((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); done: - /* End access to the va_list, if we started it */ - if (arg_started) - HDva_end(arguments); - /* Reset object wrapping info in API context */ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0) - HDONE_ERROR(H5E_VOL, H5E_CANTRESET, ret_value, "can't reset VOL wrapper info") + HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info") FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_optional() */ @@ -7630,13 +7787,13 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **req /*out*/, va_list arguments) +H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/) { H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API_NOINIT - H5TRACE6("e", "*xiIsixx", obj, connector_id, op_type, dxpl_id, req, arguments); + H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -7645,8 +7802,8 @@ H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **r HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if ((ret_value = H5VL__optional(obj, cls, op_type, dxpl_id, req, arguments)) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback") + if ((ret_value = H5VL__optional(obj, cls, args, dxpl_id, req)) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); done: FUNC_LEAVE_API_NOINIT(ret_value) |