diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/H5CX.c | 102 | ||||
-rw-r--r-- | src/H5CXprivate.h | 1 | ||||
-rw-r--r-- | src/H5Dprivate.h | 13 | ||||
-rw-r--r-- | src/H5ESint.c | 20 | ||||
-rw-r--r-- | src/H5F.c | 231 | ||||
-rw-r--r-- | src/H5Fefc.c | 140 | ||||
-rw-r--r-- | src/H5Fint.c | 94 | ||||
-rw-r--r-- | src/H5Fpkg.h | 10 | ||||
-rw-r--r-- | src/H5Fprivate.h | 3 | ||||
-rw-r--r-- | src/H5Fquery.c | 23 | ||||
-rw-r--r-- | src/H5Ldeprec.c | 12 | ||||
-rw-r--r-- | src/H5O.c | 4 | ||||
-rw-r--r-- | src/H5Odeprec.c | 12 | ||||
-rw-r--r-- | src/H5Pdevelop.h | 87 | ||||
-rw-r--r-- | src/H5Pdxpl.c | 87 | ||||
-rw-r--r-- | src/H5Pprivate.h | 3 | ||||
-rw-r--r-- | src/H5Rdeprec.c | 6 | ||||
-rw-r--r-- | src/H5Rint.c | 55 | ||||
-rw-r--r-- | src/H5T.c | 38 | ||||
-rw-r--r-- | src/H5Tconv.c | 75 | ||||
-rw-r--r-- | src/H5Tpkg.h | 32 | ||||
-rw-r--r-- | src/H5Tref.c | 218 | ||||
-rw-r--r-- | src/H5Tvlen.c | 114 | ||||
-rw-r--r-- | src/H5VL.c | 2 | ||||
-rw-r--r-- | src/H5VLcallback.c | 3637 | ||||
-rw-r--r-- | src/H5VLint.c | 64 | ||||
-rw-r--r-- | src/H5VLnative.c | 4 | ||||
-rw-r--r-- | src/H5VLnative.h | 8 | ||||
-rw-r--r-- | src/H5VLnative_file.c | 9 | ||||
-rw-r--r-- | src/H5VLprivate.h | 34 | ||||
-rw-r--r-- | src/H5VLtest.c | 9 | ||||
-rw-r--r-- | src/H5private.h | 37 | ||||
-rw-r--r-- | src/Makefile.am | 2 |
34 files changed, 4009 insertions, 1178 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index ff47c8e..dbd2c62 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -520,6 +520,7 @@ set (H5P_SOURCES ) set (H5P_HDRS + ${HDF5_SRC_DIR}/H5Pdevelop.h ${HDF5_SRC_DIR}/H5Ppublic.h ) IDE_GENERATED_PROPERTIES ("H5P" "${H5P_HDRS}" "${H5P_SOURCES}" ) @@ -664,7 +664,7 @@ done: * Failure: Negative. * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -754,7 +754,7 @@ H5CX__get_context(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -795,7 +795,7 @@ H5CX__push_common(H5CX_node_t *cnode) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 19, 2018 + * February 19, 2018 * *------------------------------------------------------------------------- */ @@ -828,7 +828,7 @@ done: * Return: <none> * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -850,6 +850,52 @@ H5CX_push_special(void) } /* end H5CX_push_special() */ /*------------------------------------------------------------------------- + * Function: H5CX_test_and_push + * + * Purpose: Pushes a context for an API call, if one isn't already pushed. + * + * Return: <none> + * + * Programmer: Quincey Koziol + * June 9, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5CX_test_and_push(hbool_t *pushed) +{ + H5CX_node_t **head = NULL; /* Pointer to head of API context list */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_NOAPI(FAIL) + + /* Sanity check */ + HDassert(pushed); + + /* Check for API context already pushed */ + head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */ + if (NULL == *head) { + H5CX_node_t *cnode = NULL; /* Context node */ + + /* Allocate & clear API context node */ + if (NULL == (cnode = H5FL_CALLOC(H5CX_node_t))) + HGOTO_ERROR(H5E_CONTEXT, H5E_CANTALLOC, FAIL, "unable to allocate new struct") + + /* Set context info */ + H5CX__push_common(cnode); + + /* Indicate that the context was pushed */ + *pushed = TRUE; + } /* end if */ + else + /* Context was not pushed */ + *pushed = FALSE; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5CX_test_and_push() */ + +/*------------------------------------------------------------------------- * Function: H5CX_retrieve_state * * Purpose: Retrieve the state of an API context, for later resumption. @@ -1312,7 +1358,7 @@ H5CX_set_lapl(hid_t lapl_id) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 19, 2018 + * February 19, 2018 * *------------------------------------------------------------------------- */ @@ -1567,7 +1613,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -1699,7 +1745,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -1729,7 +1775,7 @@ H5CX_get_tag(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 22, 2018 + * February 22, 2018 * *------------------------------------------------------------------------- */ @@ -1761,7 +1807,7 @@ H5CX_get_ring(void) * Return: TRUE / FALSE on success / <can't fail> * * Programmer: Quincey Koziol - * Februrary 23, 2018 + * February 23, 2018 * *------------------------------------------------------------------------- */ @@ -1793,7 +1839,7 @@ H5CX_get_coll_metadata_read(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -1889,7 +1935,7 @@ H5CX_get_mpio_rank0_bcast(void) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 23, 2018 + * February 23, 2018 * *------------------------------------------------------------------------- */ @@ -1925,7 +1971,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -1960,7 +2006,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -1995,7 +2041,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2030,7 +2076,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2065,7 +2111,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2102,7 +2148,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 25, 2018 + * February 25, 2018 * *------------------------------------------------------------------------- */ @@ -2137,7 +2183,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2353,7 +2399,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2388,7 +2434,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2423,7 +2469,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2878,7 +2924,7 @@ done: * Return: <none> * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -2906,7 +2952,7 @@ H5CX_set_tag(haddr_t tag) * Return: <none> * * Programmer: Quincey Koziol - * Februrary 20, 2018 + * February 20, 2018 * *------------------------------------------------------------------------- */ @@ -2936,7 +2982,7 @@ H5CX_set_ring(H5AC_ring_t ring) * Return: <none> * * Programmer: Quincey Koziol - * Februrary 23, 2018 + * February 23, 2018 * *------------------------------------------------------------------------- */ @@ -2966,7 +3012,7 @@ H5CX_set_coll_metadata_read(hbool_t cmdr) * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -2999,7 +3045,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -3033,7 +3079,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 26, 2018 + * February 26, 2018 * *------------------------------------------------------------------------- */ @@ -3658,7 +3704,7 @@ done: * Return: Non-negative on success / Negative on failure * * Programmer: Quincey Koziol - * Februrary 19, 2018 + * February 19, 2018 * *------------------------------------------------------------------------- */ diff --git a/src/H5CXprivate.h b/src/H5CXprivate.h index c500356..53bcc4c 100644 --- a/src/H5CXprivate.h +++ b/src/H5CXprivate.h @@ -63,6 +63,7 @@ typedef struct H5CX_state_t { /* Library private routines */ #ifndef H5private_H H5_DLL herr_t H5CX_push(void); +H5_DLL herr_t H5CX_test_and_push(hbool_t *pushed); H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #endif /* H5private_H */ H5_DLL void H5CX_push_special(void); diff --git a/src/H5Dprivate.h b/src/H5Dprivate.h index ad9794d..8e7fd38 100644 --- a/src/H5Dprivate.h +++ b/src/H5Dprivate.h @@ -79,12 +79,13 @@ #define H5D_MPIO_LOCAL_NO_COLLECTIVE_CAUSE_NAME \ "local_no_collective_cause" /* cause of broken collective I/O in each process */ #define H5D_MPIO_GLOBAL_NO_COLLECTIVE_CAUSE_NAME \ - "global_no_collective_cause" /* cause of broken collective I/O in all processes */ -#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ -#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ -#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ -#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ -#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */ + "global_no_collective_cause" /* cause of broken collective I/O in all processes */ +#define H5D_XFER_EDC_NAME "err_detect" /* EDC */ +#define H5D_XFER_FILTER_CB_NAME "filter_cb" /* Filter callback function */ +#define H5D_XFER_CONV_CB_NAME "type_conv_cb" /* Type conversion callback function */ +#define H5D_XFER_XFORM_NAME "data_transform" /* Data transform */ +#define H5D_XFER_DSET_IO_SEL_NAME "dset_io_selection" /* Dataset I/O selection */ +#define H5D_XFER_PLUGIN_NEW_API_CTX_NAME "plugin_new_api_context" /* Plugin new API context */ #ifdef H5_HAVE_INSTRUMENTED_LIBRARY /* Collective chunk instrumentation properties */ #define H5D_XFER_COLL_CHUNK_LINK_HARD_NAME "coll_chunk_link_hard" diff --git a/src/H5ESint.c b/src/H5ESint.c index 6f9efe9..b3edaaa 100644 --- a/src/H5ESint.c +++ b/src/H5ESint.c @@ -294,7 +294,10 @@ H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app * there's no need to duplicate it. */ ev->op_info.api_name = caller; - if (NULL == (ev->op_info.api_args = H5MM_xstrdup(api_args))) + ev->op_info.api_args = H5MM_xstrdup(api_args); + + /* 'api_args' is allowed to be NULL, but if it isn't, check for allocation failure */ + if (api_args && NULL == ev->op_info.api_args) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments") /* Append fully initialized event onto the event set's 'active' list */ @@ -817,14 +820,21 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx) /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler) * so there's no need to duplicate them internally, but they are duplicated * here, when they are given back to the user. + * + * They are also allowed to be NULL, so only check for NULL values from + * the strdup when the original string is non-NULL. */ - if (NULL == (ctx->curr_err_info->api_name = H5MM_strdup(ev->op_info.api_name))) + ctx->curr_err_info->api_name = H5MM_strdup(ev->op_info.api_name); + if (ev->op_info.api_name && NULL == ctx->curr_err_info->api_name) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine name") - if (NULL == (ctx->curr_err_info->api_args = H5MM_strdup(ev->op_info.api_args))) + ctx->curr_err_info->api_args = H5MM_strdup(ev->op_info.api_args); + if (ev->op_info.api_args && NULL == ctx->curr_err_info->api_args) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine arguments") - if (NULL == (ctx->curr_err_info->app_file_name = H5MM_strdup(ev->op_info.app_file_name))) + ctx->curr_err_info->app_file_name = H5MM_strdup(ev->op_info.app_file_name); + if (ev->op_info.app_file_name && NULL == ctx->curr_err_info->app_file_name) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application file name") - if (NULL == (ctx->curr_err_info->app_func_name = H5MM_strdup(ev->op_info.app_func_name))) + ctx->curr_err_info->app_func_name = H5MM_strdup(ev->op_info.app_func_name); + if (ev->op_info.app_func_name && NULL == ctx->curr_err_info->app_func_name) HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application function name") ctx->curr_err_info->app_line_num = ev->op_info.app_line_num; ctx->curr_err_info->op_ins_count = ev->op_info.op_ins_count; @@ -69,7 +69,6 @@ static int H5F__get_all_count_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t H5_ATTR_UNU static int H5F__get_all_ids_cb(void H5_ATTR_UNUSED *obj_ptr, hid_t obj_id, void *key); /* Helper routines for sync/async API calls */ -static herr_t H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr); static hid_t H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, void **token_ptr); static hid_t H5F__open_api_common(const char *filename, unsigned flags, hid_t fapl_id, void **token_ptr); @@ -510,43 +509,6 @@ done: } /* end H5Fis_accessible() */ /*------------------------------------------------------------------------- - * Function: H5F__post_open_api_common - * - * Purpose: This is the common function for 'post open' operations - * - * Return: SUCCEED/FAIL - * - *------------------------------------------------------------------------- - */ -static herr_t -H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr) -{ - uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_STATIC - - /* Check for 'post open' callback */ - supported = 0; - if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't check for 'post open' operation") - if (supported & H5VL_OPT_QUERY_SUPPORTED) { - H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ - - /* Set up VOL callback arguments */ - vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; - vol_cb_args.args = NULL; - - /* Make the 'post open' callback */ - if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to make file 'post open' callback") - } /* end if */ - -done: - FUNC_LEAVE_NOAPI(ret_value) -} /* end H5F__post_open_api_common() */ - -/*------------------------------------------------------------------------- * Function: H5F__create_api_common * * Purpose: This is the common function for creating new HDF5 files. @@ -558,10 +520,7 @@ done: static hid_t H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, void **token_ptr) { - void * new_file = NULL; /* File struct for new file */ - H5P_genplist_t * plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -589,18 +548,6 @@ H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_ if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") - /* Adjust bit flags by turning on the creation bit and making sure that * the EXCL or TRUNC bit is set. All newly-created files are opened for * reading and writing. @@ -610,14 +557,10 @@ H5F__create_api_common(const char *filename, unsigned flags, hid_t fcpl_id, hid_ flags |= H5F_ACC_RDWR | H5F_ACC_CREAT; /* Create a new file or truncate an existing file through the VOL */ - if (NULL == (new_file = H5VL_file_create(&connector_prop, filename, flags, fcpl_id, fapl_id, - H5P_DATASET_XFER_DEFAULT, token_ptr))) + if ((ret_value = + H5VL_file_create(filename, flags, fcpl_id, fapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to create file") - /* Get an ID for the file */ - if ((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__create_api_common() */ @@ -650,8 +593,7 @@ done: hid_t H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE4("i", "*sIuii", filename, flags, fcpl_id, fapl_id); @@ -660,14 +602,6 @@ H5Fcreate(const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id) if ((ret_value = H5F__create_api_common(filename, flags, fcpl_id, fapl_id, NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to synchronously create file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - done: FUNC_LEAVE_API(ret_value) } /* end H5Fcreate() */ @@ -687,10 +621,9 @@ hid_t H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t es_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - void * token = NULL; /* Request token for async operation */ - void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void * token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE8("i", "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id); @@ -703,12 +636,14 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c if ((ret_value = H5F__create_api_common(filename, flags, fcpl_id, fapl_id, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCREATE, H5I_INVALID_HID, "unable to asynchronously create file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* If a token was created, add the token to the event set */ - if (NULL != token) + if (NULL != token) { + H5VL_object_t *vol_obj; /* File object */ + + /* Get the file object */ + if (NULL == (vol_obj = H5VL_vol_object(ret_value))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) { @@ -717,22 +652,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") } /* end if */ - - /* Reset token for 'post open' operation */ - /* (Unnecessary if create operation didn't change it, but not worth checking -QAK) */ - token = NULL; - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - - /* 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_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) - /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -752,10 +672,8 @@ done: static hid_t H5F__open_api_common(const char *filename, unsigned flags, hid_t fapl_id, void **token_ptr) { - void * new_file = NULL; /* File struct for new file */ - H5P_genplist_t * plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t file_id = H5I_INVALID_HID; /* File ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_STATIC @@ -779,26 +697,12 @@ H5F__open_api_common(const char *filename, unsigned flags, hid_t fapl_id, void * if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") - /* Open the file through the VOL layer */ - if (NULL == (new_file = H5VL_file_open(&connector_prop, filename, flags, fapl_id, - H5P_DATASET_XFER_DEFAULT, token_ptr))) + if (NULL == H5VL_file_open(filename, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, token_ptr, &file_id)) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Get an ID for the file */ - if ((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") + /* Set return value */ + ret_value = file_id; done: FUNC_LEAVE_NOAPI(ret_value) @@ -826,8 +730,7 @@ done: hid_t H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE3("i", "*sIui", filename, flags, fapl_id); @@ -836,14 +739,6 @@ H5Fopen(const char *filename, unsigned flags, hid_t fapl_id) if ((ret_value = H5F__open_api_common(filename, flags, fapl_id, NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously open file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - done: FUNC_LEAVE_API(ret_value) } /* end H5Fopen() */ @@ -864,10 +759,9 @@ hid_t H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, const char *filename, unsigned flags, hid_t fapl_id, hid_t es_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - void * token = NULL; /* Request token for async operation */ - void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + void * token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE7("i", "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id); @@ -880,12 +774,14 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con if ((ret_value = H5F__open_api_common(filename, flags, fapl_id, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously open file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") - /* If a token was created, add the token to the event set */ - if (NULL != token) + if (NULL != token) { + H5VL_object_t *vol_obj = NULL; /* File object */ + + /* Get the file object */ + if (NULL == (vol_obj = H5VL_vol_object(ret_value))) + HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, H5I_INVALID_HID, "invalid object identifier") + /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) { @@ -894,22 +790,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") } /* end if */ - - /* Reset token for 'post open' operation */ - /* (Unnecessary if create operation didn't change it, but not worth checking -QAK) */ - token = NULL; - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - - /* 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*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) - /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + } /* end if */ done: FUNC_LEAVE_API(ret_value) @@ -1462,8 +1343,7 @@ done: hid_t H5Freopen(hid_t file_id) { - H5VL_object_t *vol_obj = NULL; /* File object */ - hid_t ret_value = H5I_INVALID_HID; /* Return value */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE1("i", "i", file_id); @@ -1472,16 +1352,7 @@ H5Freopen(hid_t file_id) if ((ret_value = H5F__reopen_api_common(file_id, NULL)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to synchronously reopen file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, NULL) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - done: - /* XXX (VOL MERGE): If registration fails, file will not be closed */ FUNC_LEAVE_API(ret_value) } /* end H5Freopen() */ @@ -1500,10 +1371,9 @@ done: hid_t H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id, hid_t es_id) { - H5VL_object_t *vol_obj = NULL; /* Object for loc_id */ - void * token = NULL; /* Request token for async operation */ - void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ - hid_t ret_value; /* Return value */ + void * token = NULL; /* Request token for async operation */ + void **token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */ + hid_t ret_value; /* Return value */ FUNC_ENTER_API(H5I_INVALID_HID) H5TRACE5("i", "*s*sIuii", app_file, app_func, app_line, file_id, es_id); @@ -1516,12 +1386,14 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h if ((ret_value = H5F__reopen_api_common(file_id, token_ptr)) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to asynchronously reopen file") - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") - /* If a token was created, add the token to the event set */ - if (NULL != token) + if (NULL != token) { + H5VL_object_t *vol_obj = NULL; /* Object for loc_id */ + + /* Get the file object */ + if (NULL == (vol_obj = H5VL_vol_object(ret_value))) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get handle for re-opened file") + /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) { @@ -1530,22 +1402,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") } /* end if */ - - /* Reset token for 'post open' operation */ - /* (Unnecessary if create operation didn't change it, but not worth checking -QAK) */ - token = NULL; - - /* Perform 'post open' operation */ - if (H5F__post_open_api_common(vol_obj, token_ptr) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "'post open' operation failed") - - /* 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_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) - /* clang-format on */ - HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") + } /* end if */ done: FUNC_LEAVE_API(ret_value) diff --git a/src/H5Fefc.c b/src/H5Fefc.c index 3f9a22f..7d6b089 100644 --- a/src/H5Fefc.c +++ b/src/H5Fefc.c @@ -63,6 +63,7 @@ struct H5F_efc_t { }; /* Private prototypes */ +static H5F_t *H5F__efc_open_real(const char *name, unsigned flags, hid_t fapl_id); static herr_t H5F__efc_release_real(H5F_efc_t *efc); static herr_t H5F__efc_remove_ent(H5F_efc_t *efc, H5F_efc_ent_t *ent); static void H5F__efc_try_close_tag1(H5F_shared_t *sf, H5F_shared_t **tail); @@ -119,6 +120,80 @@ done: } /* end H5F__efc_create() */ /*------------------------------------------------------------------------- + * Function: H5F__efc_open_real + * + * Purpose: Opens a file for the external file cache 'open' operation. + * + * Return: Pointer to open file on success + * NULL on failure + * + * Programmer: Quincey Koziol + * Saturday, June 12, 2021 + * + *------------------------------------------------------------------------- + */ +static H5F_t * +H5F__efc_open_real(const char *name, unsigned flags, hid_t fapl_id) +{ + H5VL_object_t *file_obj = NULL; /* Pointer to file VOL object */ + H5F_t * file = NULL; /* Pointer to opened file */ + hbool_t is_native; /* Whether the file VOL object is using the native VOL connector */ + H5F_t * ret_value = NULL; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity checks */ + HDassert(name); + + /* The data structures and algorithms that use this routine currently depend on + * having a native file object (H5F_t*). It seems possible to convert + * them to using a file VOL object (H5VL_object_t*), but that appears to + * be a fairly intensive task, so fail if the file VOL object is not using + * a "trivial" VOL connector stack, composed of only the native connector + * as the terminal connector, without any pass-through connectors. + */ + is_native = FALSE; + if (H5VL_fapl_is_native(fapl_id, &is_native) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't check for native VOL connector") + if (!is_native) + HGOTO_ERROR(H5E_FILE, H5E_UNSUPPORTED, NULL, "can't open files w/non-native VOL connector") + + /* Open the file VOL object */ + if (NULL == (file_obj = H5VL_file_open(name, flags, fapl_id, H5P_DATASET_XFER_DEFAULT, NULL, NULL))) + HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") + + /* Get native file pointer from VOL object */ + if (NULL == (file = H5VL_object_data(file_obj))) { + /* Close opened file */ + if (H5F__close_obj(file_obj, NULL) < 0) + HDONE_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, NULL, "can't close file") + + HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get native file pointer") + } /* end if */ + + /* Release VOL object */ + if (H5VL_free_object(file_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, NULL, "can't release file VOL object") + file_obj = NULL; + + /* Increment the number of open objects to prevent the file from being + * closed out from under us - "simulate" having an open file id. Note + * that this behaviour replaces the calls to H5F_incr_nopen_objs() and + * H5F_decr_nopen_objs() in H5L_extern_traverse(). + */ + /* NOTE: This assumes that file object is a _native_ file object and + * won't work with passthrough VOL connectors. + */ + file->nopen_objs++; + + /* Set return value */ + ret_value = file; + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__efc_open_real() */ + +/*------------------------------------------------------------------------- * Function: H5F__efc_open * * Purpose: Opens a file using the external file cache. The target @@ -138,14 +213,12 @@ done: *------------------------------------------------------------------------- */ H5F_t * -H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id) +H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fapl_id) { - H5F_efc_t * efc = NULL; /* External file cache for parent file */ - H5F_efc_ent_t * ent = NULL; /* Entry for target file in efc */ - hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */ - H5P_genplist_t * plist; /* Property list pointer for FAPL */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5F_t * ret_value = NULL; /* Return value */ + H5F_efc_t * efc = NULL; /* External file cache for parent file */ + H5F_efc_ent_t *ent = NULL; /* Entry for target file in efc */ + hbool_t open_file = FALSE; /* Whether ent->file needs to be closed in case of error */ + H5F_t * ret_value = NULL; /* Return value */ FUNC_ENTER_PACKAGE @@ -154,38 +227,16 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi HDassert(parent->shared); HDassert(name); - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, NULL, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "can't set VOL connector info in API context") - /* Get external file cache */ efc = parent->shared->efc; - /* Check if the EFC exists. If it does not, just call H5F_open(). We + /* Check if the EFC exists. If it does not, just open the file. We * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if (!efc) { - if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) + if (NULL == (ret_value = H5F__efc_open_real(name, flags, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") - /* Make file post open call */ - if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") - - /* Increment the number of open objects to prevent the file from being - * closed out from under us - "simulate" having an open file id. Note - * that this behaviour replaces the calls to H5F_incr_nopen_objs() and - * H5F_decr_nopen_objs() in H5L_extern_traverse(). */ - ret_value->nopen_objs++; - HGOTO_DONE(ret_value) } /* end if */ @@ -250,18 +301,9 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi } /* end if */ else { /* Cannot cache file, just open file and return */ - if (NULL == (ret_value = H5F_open(name, flags, fcpl_id, fapl_id))) + if (NULL == (ret_value = H5F__efc_open_real(name, flags, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") - /* Make file post open call */ - if (H5F__post_open(ret_value) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") - - /* Increment the number of open objects to prevent the file from - * being closed out from under us - "simulate" having an open - * file id */ - ret_value->nopen_objs++; - HGOTO_DONE(ret_value) } /* end else */ } /* end if */ @@ -275,18 +317,10 @@ H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hi HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Open the file */ - if (NULL == (ent->file = H5F_open(name, flags, fcpl_id, fapl_id))) + if (NULL == (ent->file = H5F__efc_open_real(name, flags, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "can't open file") open_file = TRUE; - /* Make file post open call */ - if (H5F__post_open(ent->file) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, NULL, "can't finish opening file") - - /* Increment the number of open objects to prevent the file from being - * closed out from under us - "simulate" having an open file id */ - ent->file->nopen_objs++; - /* Add the file to the cache */ /* Skip list */ if (H5SL_insert(efc->slist, ent, ent->name) < 0) @@ -372,6 +406,9 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) * support this so clients do not have to make 2 different calls depending * on the state of the efc. */ if (!efc) { + /* NOTE: This assumes that file object is a _native_ file object and + * won't work with passthrough VOL connectors. + */ file->nopen_objs--; if (H5F_try_close(file, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file") @@ -387,6 +424,9 @@ H5F_efc_close(H5F_t *parent, H5F_t *file) for (ent = efc->LRU_head; ent && ent->file != file; ent = ent->LRU_next) ; if (!ent) { + /* NOTE: This assumes that file object is a _native_ file object and + * won't work with passthrough VOL connectors. + */ file->nopen_objs--; if (H5F_try_close(file, NULL) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "can't close external file") diff --git a/src/H5Fint.c b/src/H5Fint.c index c2d3e77..ce0cd6f 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -218,6 +218,38 @@ H5F_term_package(void) } /* end H5F_term_package() */ /*------------------------------------------------------------------------- + * Function: H5F__close_obj + * + * Purpose: Close a file VOL object, possibly asynchronously. + * + * Return: SUCCEED/FAIL + * + *------------------------------------------------------------------------- + */ +herr_t +H5F__close_obj(H5VL_object_t *file_vol_obj, void **request) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_PACKAGE + + /* Sanity check */ + HDassert(file_vol_obj); + + /* Close the file */ + if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + + /* Free the VOL object; it is unnecessary to unwrap the VOL + * object before freeing it, as the object was not wrapped */ + if (H5VL_free_object(file_vol_obj) < 0) + HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5F__close_obj() */ + +/*------------------------------------------------------------------------- * Function: H5F__close_cb * * Purpose: Closes a file or causes the close operation to be pended. @@ -244,15 +276,10 @@ H5F__close_cb(H5VL_object_t *file_vol_obj, void **request) /* Sanity check */ HDassert(file_vol_obj); - /* Close the file */ - if (H5VL_file_close(file_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0) + /* Close the file object */ + if (H5F__close_obj(file_vol_obj, request) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close file") - /* Free the VOL object; it is unnecessary to unwrap the VOL - * object before freeing it, as the object was not wrapped */ - if (H5VL_free_object(file_vol_obj) < 0) - HGOTO_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") - done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5F__close_cb() */ @@ -302,6 +329,7 @@ static herr_t H5F__set_vol_conn(H5F_t *file) { H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + const H5VL_class_t * vol_cls; /* Pointer to VOL connector class for the container */ void * new_connector_info = NULL; /* Copy of connector info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -320,13 +348,12 @@ H5F__set_vol_conn(H5F_t *file) HDassert(0 != connector_prop.connector_id); /* Retrieve the connector for the ID */ - if (NULL == (file->shared->vol_cls = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) + if (NULL == (vol_cls = (H5VL_class_t *)H5I_object(connector_prop.connector_id))) HGOTO_ERROR(H5E_FILE, H5E_BADTYPE, FAIL, "not a VOL connector ID") /* Allocate and copy connector info, if it exists */ if (connector_prop.connector_info) - if (H5VL_copy_connector_info(file->shared->vol_cls, &new_connector_info, - connector_prop.connector_info) < 0) + if (H5VL_copy_connector_info(vol_cls, &new_connector_info, connector_prop.connector_info) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, FAIL, "connector info copy failed") /* Cache the connector ID & info for the container */ @@ -858,7 +885,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Target file_name is an absolute pathname: see RM for detailed description */ if (H5_CHECK_ABSOLUTE(file_name) || H5_CHECK_ABS_PATH(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, file_name, file_intent, fapl_id); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { @@ -881,7 +908,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c } /* end if */ else if (H5_CHECK_ABS_DRIVE(file_name)) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, file_name, file_intent, fapl_id); /* Adjust temporary file name if file not opened */ if (NULL == src_file) { @@ -926,8 +953,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c } /* end if */ /* Try opening file */ - src_file = - H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release copy of file name */ full_name = (char *)H5MM_xfree(full_name); @@ -939,7 +965,6 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Leave if file was opened */ else break; - H5E_clear_stack(NULL); } /* end if */ } /* end while */ @@ -954,7 +979,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") /* Try opening file */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -975,7 +1000,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't prepend prefix to filename") /* Try opening file */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -990,7 +1015,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c /* Try the relative file_name stored in temp_file_name */ if (src_file == NULL) { /* Try opening file */ - src_file = H5F__efc_open(primary_file, temp_file_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, temp_file_name, file_intent, fapl_id); /* Check for file not opened */ if (NULL == src_file) @@ -1018,7 +1043,7 @@ H5F_prefix_open_file(H5F_t *primary_file, H5F_prefix_open_t prefix_type, const c actual_file_name = (char *)H5MM_xfree(actual_file_name); /* Try opening with the resolved name */ - src_file = H5F__efc_open(primary_file, full_name, file_intent, H5P_FILE_CREATE_DEFAULT, fapl_id); + src_file = H5F__efc_open(primary_file, full_name, file_intent, fapl_id); /* Release name */ full_name = (char *)H5MM_xfree(full_name); @@ -1121,7 +1146,6 @@ H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5F if (NULL == (f = H5FL_CALLOC(H5F_t))) HGOTO_ERROR(H5E_FILE, H5E_NOSPACE, NULL, "can't allocate top file structure") - f->id_exists = FALSE; if (shared) { HDassert(lf == NULL); @@ -1596,7 +1620,6 @@ H5F__dest(H5F_t *f, hbool_t flush) if (H5I_dec_ref(f->shared->vol_id) < 0) /* Push error, but keep going*/ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "can't close VOL connector ID") - f->shared->vol_cls = NULL; /* Close the file */ if (H5FD_close(f->shared->lf) < 0) @@ -1630,16 +1653,6 @@ H5F__dest(H5F_t *f, hbool_t flush) f->open_name = (char *)H5MM_xfree(f->open_name); f->actual_name = (char *)H5MM_xfree(f->actual_name); if (f->vol_obj) { - void *vol_wrap_ctx = NULL; - - /* If a VOL wrapping context is available, retrieve it - * and unwrap file VOL object - */ - if (H5CX_get_vol_wrap_ctx((void **)&vol_wrap_ctx) < 0) - HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get VOL object wrap context") - if (vol_wrap_ctx && (NULL == H5VL_object_unwrap(f->vol_obj))) - HDONE_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't unwrap VOL object") - if (H5VL_free_object(f->vol_obj) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object") f->vol_obj = NULL; @@ -2124,21 +2137,22 @@ done: *------------------------------------------------------------------------- */ herr_t -H5F__post_open(H5F_t *f) +H5F__post_open(H5F_t *f, H5VL_object_t *vol_obj, hbool_t id_exists) { - herr_t ret_value = SUCCEED; /* Return value */ - - FUNC_ENTER_PACKAGE + FUNC_ENTER_PACKAGE_NOERR /* Sanity check arguments */ HDassert(f); + HDassert(vol_obj); - /* Store a vol object in the file struct */ - if (NULL == (f->vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, f, f->shared->vol_id))) - HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't create VOL object") + /* Have an ID now? */ + f->id_exists = id_exists; -done: - FUNC_LEAVE_NOAPI(ret_value) + /* Store a VOL object in the file struct */ + (void)H5VL_object_inc_rc(vol_obj); + f->vol_obj = vol_obj; + + FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5F__post_open() */ /*------------------------------------------------------------------------- diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h index b016696..752abc0 100644 --- a/src/H5Fpkg.h +++ b/src/H5Fpkg.h @@ -309,9 +309,8 @@ struct H5F_shared_t { hbool_t closing; /* File is in the process of being closed */ /* Cached VOL connector ID & info */ - hid_t vol_id; /* ID of VOL connector for the container */ - const H5VL_class_t *vol_cls; /* Pointer to VOL connector class for the container */ - void * vol_info; /* Copy of VOL connector info for container */ + hid_t vol_id; /* ID of VOL connector for the container */ + void *vol_info; /* Copy of VOL connector info for container */ /* File space allocation information */ H5F_fspace_strategy_t fs_strategy; /* File space handling strategy */ @@ -404,7 +403,7 @@ H5_DLLVAR htri_t use_locks_env_g; /******************************/ /* General routines */ -H5_DLL herr_t H5F__post_open(H5F_t *f); +H5_DLL herr_t H5F__post_open(H5F_t *f, H5VL_object_t *vol_obj, hbool_t id_exists); H5_DLL H5F_t *H5F__reopen(H5F_t *f); H5_DLL herr_t H5F__flush(H5F_t *f); H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id); @@ -413,6 +412,7 @@ H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo); H5_DLL herr_t H5F__format_convert(H5F_t *f); H5_DLL herr_t H5F__start_swmr_write(H5F_t *f); H5_DLL herr_t H5F__close(H5F_t *f); +H5_DLL herr_t H5F__close_obj(H5VL_object_t *file_vol_obj, void **request); H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high); H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info); H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks); @@ -456,7 +456,7 @@ H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag); /* External file cache routines */ H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles); -H5_DLL H5F_t * H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id); +H5_DLL H5F_t * H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fapl_id); H5_DLL unsigned H5F__efc_max_nfiles(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_release(H5F_efc_t *efc); H5_DLL herr_t H5F__efc_destroy(H5F_efc_t *efc); diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 051abd9..7298b17 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -379,7 +379,6 @@ typedef struct H5F_t H5F_t; #define H5F_NULL_FSM_ADDR(F) ((F)->shared->null_fsm_addr) #define H5F_GET_MIN_DSET_OHDR(F) ((F)->shared->crt_dset_min_ohdr_flag) #define H5F_SET_MIN_DSET_OHDR(F, V) ((F)->shared->crt_dset_min_ohdr_flag = (V)) -#define H5F_VOL_CLS(F) ((F)->shared->vol_cls) #define H5F_VOL_OBJ(F) ((F)->vol_obj) #define H5F_USE_FILE_LOCKING(F) ((F)->shared->use_file_locking) #else /* H5F_MODULE */ @@ -442,7 +441,6 @@ typedef struct H5F_t H5F_t; #define H5F_NULL_FSM_ADDR(F) (H5F_get_null_fsm_addr(F)) #define H5F_GET_MIN_DSET_OHDR(F) (H5F_get_min_dset_ohdr(F)) #define H5F_SET_MIN_DSET_OHDR(F, V) (H5F_set_min_dset_ohdr((F), (V))) -#define H5F_VOL_CLS(F) (H5F_get_vol_cls(F)) #define H5F_VOL_OBJ(F) (H5F_get_vol_obj(F)) #define H5F_USE_FILE_LOCKING(F) (H5F_get_use_file_locking(F)) #endif /* H5F_MODULE */ @@ -859,7 +857,6 @@ H5_DLL hbool_t H5F_get_point_of_no_return(const H5F_t *f); H5_DLL hbool_t H5F_get_null_fsm_addr(const H5F_t *f); H5_DLL hbool_t H5F_get_min_dset_ohdr(const H5F_t *f); H5_DLL herr_t H5F_set_min_dset_ohdr(H5F_t *f, hbool_t minimize); -H5_DLL const H5VL_class_t *H5F_get_vol_cls(const H5F_t *f); H5_DLL H5VL_object_t *H5F_get_vol_obj(const H5F_t *f); H5_DLL hbool_t H5F_get_file_locking(const H5F_t *f); diff --git a/src/H5Fquery.c b/src/H5Fquery.c index 04792b4..e57744c 100644 --- a/src/H5Fquery.c +++ b/src/H5Fquery.c @@ -1222,29 +1222,6 @@ H5F_get_null_fsm_addr(const H5F_t *f) } /* end H5F_get_null_fsm_addr() */ /*------------------------------------------------------------------------- - * Function: H5F_get_vol_cls - * - * Purpose: Get the VOL class for the file - * - * Return: VOL class pointer for file, can't fail - * - * Programmer: Quincey Koziol - * Saturday, August 17, 2019 - * - *------------------------------------------------------------------------- - */ -const H5VL_class_t * -H5F_get_vol_cls(const H5F_t *f) -{ - FUNC_ENTER_NOAPI_NOINIT_NOERR - - HDassert(f); - HDassert(f->shared); - - FUNC_LEAVE_NOAPI(f->shared->vol_cls) -} /* end H5F_get_vol_cls */ - -/*------------------------------------------------------------------------- * Function: H5F_get_vol_obj * * Purpose: Get the VOL object for the file diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c index 01e77f9..6fa6401 100644 --- a/src/H5Ldeprec.c +++ b/src/H5Ldeprec.c @@ -168,7 +168,7 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -259,7 +259,7 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -340,7 +340,7 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -435,7 +435,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -538,7 +538,7 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -631,7 +631,7 @@ H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL, @@ -120,9 +120,9 @@ H5O__open_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **token H5P_DATASET_XFER_DEFAULT, token_ptr))) HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open object") - /* Get an atom for the object */ + /* Get an ID for the object */ if ((ret_value = H5VL_register(opened_type, opened_obj, (*vol_obj_ptr)->connector, TRUE)) < 0) - HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to atomize object handle") + HGOTO_ERROR(H5E_OHDR, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to get ID for object handle") done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c index 7def20a..136260c 100644 --- a/src/H5Odeprec.c +++ b/src/H5Odeprec.c @@ -365,7 +365,7 @@ H5Oopen_by_addr(hid_t loc_id, haddr_t addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (is_native_vol_obj) { @@ -584,7 +584,7 @@ H5Oget_info2(hid_t loc_id, H5O_info1_t *oinfo /*out*/, unsigned fields) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -650,7 +650,7 @@ H5Oget_info_by_name2(hid_t loc_id, const char *name, H5O_info1_t *oinfo /*out*/, HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -722,7 +722,7 @@ H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -976,7 +976,7 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1 HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) @@ -1081,7 +1081,7 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Check if the VOL object is a native VOL connector object */ - if (H5VL_object_is_native(vol_obj, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, H5I_INVALID_HID, "can't determine if VOL object is native connector object") if (!is_native_vol_obj) diff --git a/src/H5Pdevelop.h b/src/H5Pdevelop.h new file mode 100644 index 0000000..c9d65c4 --- /dev/null +++ b/src/H5Pdevelop.h @@ -0,0 +1,87 @@ +/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Copyright by The HDF Group. * + * All rights reserved. * + * * + * This file is part of HDF5. The full HDF5 copyright notice, including * + * terms governing use, modification, and redistribution, is contained in * + * the COPYING file, which can be found at the root of the source code * + * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. * + * If you do not have access to either file, you may request a copy from * + * help@hdfgroup.org. * + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ + +/* + * This file contains public declarations for the H5P (property list) developer + * support routines. + */ + +#ifndef _H5Pdevelop_H +#define _H5Pdevelop_H + +/* Include package's public header */ +#include "H5Ppublic.h" + +/*****************/ +/* Public Macros */ +/*****************/ + +/*******************/ +/* Public Typedefs */ +/*******************/ + +/********************/ +/* Public Variables */ +/********************/ + +/*********************/ +/* Public Prototypes */ +/*********************/ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * + * \ingroup DXPL + * + * \brief Sets "new API context" flag for plugin API wrapper call. + * + * \dxpl_id{plist_id} + * \param[in] new_api_ctx Indicate that API wrapper should create new API context + * \return \herr_t + * + * \details Set flag to indicate that an API wrapper for a plugin's + * public wrapper API call (e.g. H5VLfile_create, H5FDopen, etc) + * should open a new API context for the API call. + * + */ +H5_DLL herr_t H5Pset_plugin_new_api_context(hid_t plist_id, hbool_t new_api_ctx); + +/** + * \ingroup DXPL + * + * \brief Gets "new API context" flag for plugin API wrapper call. + * + * \dxpl_id{plist_id} + * \param[out] new_api_ctx Flag indicating API wrapper should create new API context + * \return \herr_t + * + * \details Retrieve "new API context" flag for plugin wrapper API calls. + * + */ +H5_DLL herr_t H5Pget_plugin_new_api_context(hid_t plist_id, hbool_t *new_api_ctx); + +#ifdef __cplusplus +} +#endif + +/* Symbols defined for compatibility with previous versions of the HDF5 API. + * + * Use of these symbols is deprecated. + */ +#ifndef H5_NO_DEPRECATED_SYMBOLS + +#endif /* H5_NO_DEPRECATED_SYMBOLS */ + +#endif /* _H5Pdevelop_H */ diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c index 046b046..dcaa415 100644 --- a/src/H5Pdxpl.c +++ b/src/H5Pdxpl.c @@ -169,6 +169,11 @@ #define H5D_XFER_DSET_IO_SEL_ENC H5P__dxfr_edc_enc #define H5D_XFER_DSET_IO_SEL_DEC H5P__dxfr_edc_dec #endif /* QAK */ +/* Definition for property */ +#define H5D_XFER_PLUGIN_NEW_API_CTX_SIZE sizeof(hbool_t) +#define H5D_XFER_PLUGIN_NEW_API_CTX_DEF FALSE +#define H5D_XFER_PLUGIN_NEW_API_CTX_ENC H5P__encode_hbool_t +#define H5D_XFER_PLUGIN_NEW_API_CTX_DEC H5P__decode_hbool_t /******************/ /* Local Typedefs */ @@ -278,6 +283,8 @@ static const H5T_conv_cb_t H5D_def_conv_cb_g = static const void * H5D_def_xfer_xform_g = H5D_XFER_XFORM_DEF; /* Default value for data transform */ static const H5S_t *H5D_def_dset_io_sel_g = H5D_XFER_DSET_IO_SEL_DEF; /* Default value for dataset I/O selection */ +static const hbool_t H5D_def_new_api_ctx_g = + H5D_XFER_PLUGIN_NEW_API_CTX_DEF; /* Default value for plugin new API context */ /*------------------------------------------------------------------------- * Function: H5P__dxfr_reg_prop @@ -442,6 +449,12 @@ H5P__dxfr_reg_prop(H5P_genclass_t *pclass) H5D_XFER_DSET_IO_SEL_CLOSE) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + /* Register the plugin new API context property */ + if (H5P__register_real(pclass, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, H5D_XFER_PLUGIN_NEW_API_CTX_SIZE, + &H5D_def_new_api_ctx_g, NULL, NULL, NULL, H5D_XFER_PLUGIN_NEW_API_CTX_ENC, + H5D_XFER_PLUGIN_NEW_API_CTX_DEC, NULL, NULL, NULL, NULL) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class") + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5P__dxfr_reg_prop() */ @@ -2281,7 +2294,7 @@ herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[], const hsize_t stride[], const hsize_t count[], const hsize_t block[]) { - H5P_genplist_t *plist; /* Property list pointer */ + H5P_genplist_t *plist = NULL; /* Property list pointer */ H5S_t * space; /* Dataspace to hold selection */ hbool_t space_created = FALSE; /* Whether a new dataspace has been created */ hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */ @@ -2379,3 +2392,75 @@ done: FUNC_LEAVE_API(ret_value) } /* end H5Pset_dataset_io_hyperslab_selection() */ + +/*------------------------------------------------------------------------- + * Function: H5Pset_plugin_new_api_context + * + * Purpose: Set flag to indicate that an API wrapper for a plugin's + * public wrapper API call (e.g. H5VLfile_create, H5FDopen, etc) + * should open a new API context for the API call. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Jun 11, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pset_plugin_new_api_context(hid_t plist_id, hbool_t new_api_ctx) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ib", plist_id, new_api_ctx); + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") + + /* Update property list */ + if (H5P_set(plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "unable to set value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pset_plugin_new_api_context() */ + +/*------------------------------------------------------------------------- + * Function: H5Pget_plugin_new_api_context + * + * Purpose: Retrieve "new API context" flag for plugin wrapper API calls. + * + * Return: Non-negative on success/Negative on failure + * + * Programmer: Quincey Koziol + * Jun 11, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5Pget_plugin_new_api_context(hid_t plist_id, hbool_t *new_api_ctx /*out*/) +{ + H5P_genplist_t *plist; /* Property list pointer */ + herr_t ret_value = SUCCEED; /* return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE2("e", "ix", plist_id, new_api_ctx); + + /* Check argument */ + if (NULL == new_api_ctx) + HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "'new_api_ctx' pointer is NULL") + + /* Get the plist structure */ + if (NULL == (plist = H5P_object_verify(plist_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_PLIST, H5E_BADID, FAIL, "can't find object for ID") + + /* Query property list */ + if (H5P_get(plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, new_api_ctx) < 0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "unable to get value") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5Pget_plugin_new_api_context() */ diff --git a/src/H5Pprivate.h b/src/H5Pprivate.h index 6ebe5d3..42e1d6e 100644 --- a/src/H5Pprivate.h +++ b/src/H5Pprivate.h @@ -20,7 +20,8 @@ /* Early typedefs to avoid circular dependencies */ typedef struct H5P_genplist_t H5P_genplist_t; -/* Include package's public header */ +/* Include package's public headers */ +#include "H5Pdevelop.h" #include "H5Ppublic.h" /* Private headers needed by this file */ diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c index 3f1d70f..e18b7f9 100644 --- a/src/H5Rdeprec.c +++ b/src/H5Rdeprec.c @@ -104,7 +104,7 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(vol_obj, &is_native) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -409,7 +409,7 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(vol_obj, &is_native) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -659,7 +659,7 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref) hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(vol_obj, &is_native) < 0) + if (H5VL_object_is_native(vol_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't query if file uses native VOL connector") diff --git a/src/H5Rint.c b/src/H5Rint.c index e1a5dcd..eafc5c4 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -542,12 +542,8 @@ H5R__get_loc_id(const H5R_ref_priv_t *ref) hid_t H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) { - H5P_genplist_t * plist; /* Property list for FAPL */ - void * new_file = NULL; /* File object opened */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5VL_object_t * vol_obj = NULL; /* VOL object for file */ - uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ - hid_t ret_value = H5I_INVALID_HID; + hid_t file_id = H5I_INVALID_HID; /* New file's ID */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ FUNC_ENTER_PACKAGE @@ -557,54 +553,19 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id) if (H5CX_set_apl(&fapl_id, H5P_CLS_FACC, H5I_INVALID_HID, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "can't set access property list info") - /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") - - /* Stash a copy of the "top-level" connector property, before any pass-through - * connectors modify or unwrap it. - */ - if (H5CX_set_vol_connector_prop(&connector_prop) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, - "can't set VOL connector info in API context") - /* Open the file */ /* (Must open file read-write to allow for object modifications) */ - if (NULL == (new_file = H5VL_file_open(&connector_prop, H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, - H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL))) + if (NULL == H5VL_file_open(H5R_REF_FILENAME(ref), H5F_ACC_RDWR, fapl_id, H5P_DATASET_XFER_DEFAULT, + H5_REQUEST_NULL, &file_id)) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, H5I_INVALID_HID, "unable to open file") - /* Get an ID for the file */ - if ((ret_value = H5VL_register_using_vol_id(H5I_FILE, new_file, connector_prop.connector_id, TRUE)) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle") - - /* Get the file object */ - if (NULL == (vol_obj = H5VL_vol_object(ret_value))) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "invalid object identifier") - - /* Make the 'post open' callback */ - supported = 0; - if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation") - if (supported & H5VL_OPT_QUERY_SUPPORTED) { - H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ - - /* Set up VOL callback arguments */ - vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; - vol_cb_args.args = NULL; - - /* Make the 'post open' callback */ - if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) - HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID, - "unable to make file 'post open' callback") - } /* end if */ - /* Attach loc_id to reference */ - if (H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0) + if (H5R__set_loc_id((H5R_ref_priv_t *)ref, file_id, FALSE, TRUE) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTSET, H5I_INVALID_HID, "unable to attach location id to reference") + /* Set return value */ + ret_value = file_id; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__reopen_file() */ @@ -252,10 +252,10 @@ { \ H5T_INIT_TYPE_ALLOC_COMMON(H5T_REFERENCE) \ H5T_INIT_TYPE_NUM_COMMON(H5T_ORDER_NONE) \ - dt->shared->force_conv = TRUE; \ - dt->shared->u.atomic.u.r.file = NULL; \ - dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \ - dt->shared->u.atomic.u.r.cls = NULL; \ + dt->shared->force_conv = TRUE; \ + dt->shared->u.atomic.u.r.file_obj = NULL; \ + dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; \ + dt->shared->u.atomic.u.r.cls = NULL; \ } #define H5T_INIT_TYPE_OBJREF_CORE \ @@ -4821,9 +4821,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) } /* Don't allow VL types in different files to compare as equal */ - if (dt1->shared->u.vlen.file < dt2->shared->u.vlen.file) + if (dt1->shared->u.vlen.file_obj < dt2->shared->u.vlen.file_obj) HGOTO_DONE(-1); - if (dt1->shared->u.vlen.file > dt2->shared->u.vlen.file) + if (dt1->shared->u.vlen.file_obj > dt2->shared->u.vlen.file_obj) HGOTO_DONE(1); break; @@ -4970,9 +4970,9 @@ H5T_cmp(const H5T_t *dt1, const H5T_t *dt2, hbool_t superset) HGOTO_DONE(-1); if (dt1->shared->u.atomic.u.r.loc > dt2->shared->u.atomic.u.r.loc) HGOTO_DONE(1); - if (dt1->shared->u.atomic.u.r.file < dt2->shared->u.atomic.u.r.file) + if (dt1->shared->u.atomic.u.r.file_obj < dt2->shared->u.atomic.u.r.file_obj) HGOTO_DONE(-1); - if (dt1->shared->u.atomic.u.r.file > dt2->shared->u.atomic.u.r.file) + if (dt1->shared->u.atomic.u.r.file_obj > dt2->shared->u.atomic.u.r.file_obj) HGOTO_DONE(1); break; @@ -5832,7 +5832,7 @@ done: USAGE htri_t H5T_set_loc(dt,f,loc) H5T_t *dt; IN/OUT: Pointer to the datatype to mark - H5F_t *f; IN: Pointer to the file the datatype is in + H5VL_object_t *file_obj; IN: Pointer to the VOL file object the datatype is in H5T_loc_t loc IN: location of type RETURNS @@ -5846,7 +5846,7 @@ done: -------------------------------------------------------------------------- */ htri_t -H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) +H5T_set_loc(H5T_t *dt, H5VL_object_t *file_obj, H5T_loc_t loc) { htri_t changed; /* Whether H5T_set_loc changed the type (even if the size didn't change) */ htri_t ret_value = 0; /* Indicate that success, but no location change */ @@ -5871,7 +5871,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) old_size = dt->shared->parent->shared->size; /* Mark the VL, compound or array type */ - if ((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0) + if ((changed = H5T_set_loc(dt->shared->parent, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location") if (changed > 0) ret_value = changed; @@ -5912,7 +5912,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) old_size = memb_type->shared->size; /* Mark the VL, compound, enum or array type */ - if ((changed = H5T_set_loc(memb_type, file, loc)) < 0) + if ((changed = H5T_set_loc(memb_type, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if (changed > 0) ret_value = changed; @@ -5951,14 +5951,14 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) if (dt->shared->parent->shared->force_conv && H5T_IS_COMPLEX(dt->shared->parent->shared->type) && (dt->shared->parent->shared->type != H5T_REFERENCE)) { - if ((changed = H5T_set_loc(dt->shared->parent, file, loc)) < 0) + if ((changed = H5T_set_loc(dt->shared->parent, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if (changed > 0) ret_value = changed; } /* end if */ /* Mark this VL sequence */ - if ((changed = H5T__vlen_set_loc(dt, file, loc)) < 0) + if ((changed = H5T__vlen_set_loc(dt, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "Unable to set VL location"); if (changed > 0) ret_value = changed; @@ -5966,7 +5966,7 @@ H5T_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) case H5T_REFERENCE: /* Reference types go through type conversion */ - if ((ret_value = H5T__ref_set_loc(dt, file, loc)) < 0) + if ((ret_value = H5T__ref_set_loc(dt, file_obj, loc)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "Unable to set reference location"); break; @@ -6308,17 +6308,17 @@ done: *------------------------------------------------------------------------- */ herr_t -H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file) +H5T_patch_vlen_file(H5T_t *dt, H5VL_object_t *file_obj) { FUNC_ENTER_NOAPI_NOINIT_NOERR /* Sanity check */ HDassert(dt); HDassert(dt->shared); - HDassert(file); + HDassert(file_obj); - if ((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.file != file) - dt->shared->u.vlen.file = file; + if ((dt->shared->type == H5T_VLEN) && dt->shared->u.vlen.file_obj != file_obj) + dt->shared->u.vlen.file_obj = file_obj; FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5T_patch_vlen_file() */ diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 0c98633..7ea3d4c 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3161,12 +3161,17 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si /* QAK - Nothing to do currently */ break; - case H5T_CONV_CONV: + case H5T_CONV_CONV: { + H5T_vlen_t *src_vl; /* Source VL type info */ + H5T_vlen_t *dst_vl; /* Destination VL type info */ + /* * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + src_vl = &src->shared->u.vlen; + dst_vl = &dst->shared->u.vlen; /* Initialize source & destination strides */ if (buf_stride) { @@ -3205,14 +3210,14 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy src type for conversion") /* References need to know about the src file */ if (tsrc_cpy->shared->type == H5T_REFERENCE) - if (H5T_set_loc(tsrc_cpy, src->shared->u.vlen.file, H5T_LOC_MEMORY) < 0) + if (H5T_set_loc(tsrc_cpy, src_vl->file_obj, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); if (NULL == (tdst_cpy = H5T_copy(dst->shared->parent, H5T_COPY_ALL))) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTCOPY, FAIL, "unable to copy dst type for conversion") /* References need to know about the dst file */ if (tdst_cpy->shared->type == H5T_REFERENCE) - if (H5T_set_loc(tdst_cpy, dst->shared->u.vlen.file, H5T_LOC_MEMORY) < 0) + if (H5T_set_loc(tdst_cpy, dst_vl->file_obj, H5T_LOC_MEMORY) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set datatype location"); if (((tsrc_id = H5I_register(H5I_DATATYPE, tsrc_cpy, FALSE)) < 0) || @@ -3240,7 +3245,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to retrieve VL allocation info") /* Set flags to indicate we are writing to or reading from the file */ - if (dst->shared->u.vlen.file != NULL) + if (dst_vl->file_obj != NULL) write_to_file = TRUE; /* Set the flag for nested VL case */ @@ -3292,25 +3297,25 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si hbool_t is_nil; /* Whether sequence is "nil" */ /* Check for "nil" source sequence */ - if ((*(src->shared->u.vlen.cls->isnull))(src->shared->u.vlen.file, s, &is_nil) < 0) + if ((*(src_vl->cls->isnull))(src_vl->file_obj, s, &is_nil) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if VL data is 'nil'") else if (is_nil) { /* Write "nil" sequence to destination location */ - if ((*(dst->shared->u.vlen.cls->setnull))(dst->shared->u.vlen.file, d, b) < 0) + if ((*(dst_vl->cls->setnull))(dst_vl->file_obj, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set VL data to 'nil'") } /* end else-if */ else { size_t seq_len; /* The number of elements in the current sequence */ /* Get length of element sequences */ - if ((*(src->shared->u.vlen.cls->getlen))(src->shared->u.vlen.file, s, &seq_len) < 0) + if ((*(src_vl->cls->getlen))(src_vl->file_obj, s, &seq_len) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") /* If we are reading from memory and there is no conversion, just get the pointer to * sequence */ if (write_to_file && noop_conv) { /* Get direct pointer to sequence */ - if (NULL == (conv_buf = (*(src->shared->u.vlen.cls->getptr))(s))) + if (NULL == (conv_buf = (*(src_vl->cls->getptr))(s))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid source pointer") } /* end if */ else { @@ -3339,8 +3344,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si } /* end else-if */ /* Read in VL sequence */ - if ((*(src->shared->u.vlen.cls->read))(src->shared->u.vlen.file, s, conv_buf, - src_size) < 0) + if ((*(src_vl->cls->read))(src_vl->file_obj, s, conv_buf, src_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") } /* end else */ @@ -3363,8 +3367,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si HDassert(write_to_file); /* Get length of background element sequence */ - if ((*(dst->shared->u.vlen.cls->getlen))(dst->shared->u.vlen.file, b, - &bg_seq_len) < 0) + if ((*(dst_vl->cls->getlen))(dst_vl->file_obj, b, &bg_seq_len) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "bad sequence length") /* Read sequence if length > 0 */ @@ -3379,9 +3382,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si } /* end if */ /* Read in background VL sequence */ - if ((*(dst->shared->u.vlen.cls->read))(dst->shared->u.vlen.file, b, - tmp_buf, - bg_seq_len * dst_base_size) < 0) + if ((*(dst_vl->cls->read))(dst_vl->file_obj, b, tmp_buf, + bg_seq_len * dst_base_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read VL data") } /* end if */ @@ -3398,8 +3400,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si } /* end if */ /* Write sequence to destination location */ - if ((*(dst->shared->u.vlen.cls->write))(dst->shared->u.vlen.file, &vl_alloc_info, d, - conv_buf, b, seq_len, dst_base_size) < 0) + if ((*(dst_vl->cls->write))(dst_vl->file_obj, &vl_alloc_info, d, conv_buf, b, seq_len, + dst_base_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write VL data") if (!noop_conv) { @@ -3415,7 +3417,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si tmp = (uint8_t *)tmp_buf + seq_len * dst_base_size; for (u = seq_len; u < bg_seq_len; u++, tmp += dst_base_size) { /* Delete sequence in destination location */ - if ((*(dst->shared->u.vlen.cls->del))(dst->shared->u.vlen.file, tmp) < 0) + if ((*(dst_vl->cls->del))(dst_vl->file_obj, tmp) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove heap object") } /* end for */ @@ -3438,7 +3440,8 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, si H5I_dec_ref(tsrc_id); if (tdst_id >= 0) H5I_dec_ref(tdst_id); - break; + } /* end case */ + break; default: /* Some other command we don't know about yet.*/ HGOTO_ERROR(H5E_DATATYPE, H5E_UNSUPPORTED, FAIL, "unknown conversion command") @@ -3667,13 +3670,19 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz break; case H5T_CONV_CONV: { + H5T_atomic_ref_t *src_ref; /* Source reference type info */ + H5T_atomic_ref_t *dst_ref; /* Destination reference type info */ + /* * Conversion. */ if (NULL == (src = (H5T_t *)H5I_object(src_id)) || NULL == (dst = (H5T_t *)H5I_object(dst_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") + src_ref = &src->shared->u.atomic.u.r; + dst_ref = &dst->shared->u.atomic.u.r; - HDassert(src->shared->u.atomic.u.r.cls); + HDassert(src_ref->cls); + HDassert(dst_ref->cls); /* Initialize source & destination strides */ if (buf_stride) { @@ -3744,22 +3753,19 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz hbool_t is_nil; /* Whether reference is "nil" */ /* Check for "nil" source reference */ - if ((*(src->shared->u.atomic.u.r.cls->isnull))(src->shared->u.atomic.u.r.file, s, - &is_nil) < 0) + if ((*(src_ref->cls->isnull))(src_ref->file_obj, s, &is_nil) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't check if reference data is 'nil'") if (is_nil) { /* Write "nil" reference to destination location */ - if ((*(dst->shared->u.atomic.u.r.cls->setnull))(dst->shared->u.atomic.u.r.file, d, - b) < 0) + if ((*(dst_ref->cls->setnull))(dst_ref->file_obj, d, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't set reference data to 'nil'") } /* end else-if */ else { /* Get size of references */ - if (0 == (buf_size = src->shared->u.atomic.u.r.cls->getsize( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, &dst_copy))) + if (0 == (buf_size = src_ref->cls->getsize(src_ref->file_obj, s, src->shared->size, + dst_ref->file_obj, &dst_copy))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unable to obtain size of reference") /* Check if conversion buffer is large enough, resize if necessary. */ @@ -3771,24 +3777,21 @@ H5T__conv_ref(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, siz HDmemset(conv_buf, 0, conv_buf_size); } /* end if */ - if (dst_copy && (src->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) + if (dst_copy && (src_ref->loc == H5T_LOC_DISK)) H5MM_memcpy(conv_buf, s, buf_size); else { /* Read reference */ - if (src->shared->u.atomic.u.r.cls->read( - src->shared->u.atomic.u.r.file, s, src->shared->size, - dst->shared->u.atomic.u.r.file, conv_buf, buf_size) < 0) + if (src_ref->cls->read(src_ref->file_obj, s, src->shared->size, dst_ref->file_obj, + conv_buf, buf_size) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_READERROR, FAIL, "can't read reference data") } /* end else */ - if (dst_copy && (dst->shared->u.atomic.u.r.loc == H5T_LOC_DISK)) + if (dst_copy && (dst_ref->loc == H5T_LOC_DISK)) H5MM_memcpy(d, conv_buf, buf_size); else { /* Write reference to destination location */ - if (dst->shared->u.atomic.u.r.cls->write( - src->shared->u.atomic.u.r.file, conv_buf, buf_size, - src->shared->u.atomic.u.r.rtype, dst->shared->u.atomic.u.r.file, d, - dst->shared->size, b) < 0) + if (dst_ref->cls->write(src_ref->file_obj, conv_buf, buf_size, src_ref->rtype, + dst_ref->file_obj, d, dst->shared->size, b) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_WRITEERROR, FAIL, "can't write reference data") } /* end else */ } /* end else */ diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h index 51ecaca..95c5732 100644 --- a/src/H5Tpkg.h +++ b/src/H5Tpkg.h @@ -199,6 +199,15 @@ typedef struct H5T_ref_class_t { H5T_ref_writefunc_t write; /* write reference from buffer */ } H5T_ref_class_t; +typedef struct H5T_atomic_ref_t { + H5R_type_t rtype; /* type of reference stored */ + unsigned version; /* version of encoded reference */ + hbool_t opaque; /* opaque reference type */ + H5T_loc_t loc; /* location of data in buffer */ + H5VL_object_t * file_obj; /* File VOL object (if data is on disk) */ + const H5T_ref_class_t *cls; /* Pointer to ref class callbacks */ +} H5T_atomic_ref_t; + typedef struct H5T_atomic_t { H5T_order_t order; /* byte order */ size_t prec; /* precision in bits */ @@ -226,14 +235,7 @@ typedef struct H5T_atomic_t { H5T_str_t pad; /* space or null padding of extra bytes */ } s; /* string types */ - struct { - H5R_type_t rtype; /* type of reference stored */ - unsigned version; /* version of encoded reference */ - hbool_t opaque; /* opaque reference type */ - H5T_loc_t loc; /* location of data in buffer */ - H5VL_object_t * file; /* file VOL pointer (if data is on disk) */ - const H5T_ref_class_t *cls; /* Pointer to ref class callbacks */ - } r; /* reference types */ + H5T_atomic_ref_t r; /* Reference type info */ } u; } H5T_atomic_t; @@ -302,13 +304,13 @@ typedef struct H5T_vlen_class_t { /* A VL datatype */ typedef struct H5T_vlen_t { - H5T_vlen_type_t type; /* Type of VL data in buffer */ - H5T_loc_t loc; /* Location of VL data in buffer */ - H5T_cset_t cset; /* For VL string: character set */ - H5T_str_t pad; /* For VL string: space or null padding of - * extra bytes */ - H5VL_object_t * file; /* File object (if VL data is on disk) */ - const H5T_vlen_class_t *cls; /* Pointer to VL class callbacks */ + H5T_vlen_type_t type; /* Type of VL data in buffer */ + H5T_loc_t loc; /* Location of VL data in buffer */ + H5T_cset_t cset; /* For VL string: character set */ + H5T_str_t pad; /* For VL string: space or null padding of + * extra bytes */ + H5VL_object_t * file_obj; /* File VOL object (if VL data is on disk) */ + const H5T_vlen_class_t *cls; /* Pointer to VL class callbacks */ } H5T_vlen_t; /* An opaque datatype */ diff --git a/src/H5Tref.c b/src/H5Tref.c index cac8cf6..3a6a8c7 100644 --- a/src/H5Tref.c +++ b/src/H5Tref.c @@ -70,39 +70,40 @@ struct H5Tref_dsetreg { /* Local Prototypes */ /********************/ -static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); -static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); -static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_mem_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); -static herr_t H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, size_t dst_size, - void *bg_buf); - -static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); -static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf); -static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); -static herr_t H5T__ref_disk_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5R_type_t src_type, H5VL_object_t *dst_file, void *dst_buf, +static herr_t H5T__ref_mem_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_mem_setnull(H5VL_object_t *dst_file_obj, void *dst_buf, void *bg_buf); +static size_t H5T__ref_mem_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_mem_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_mem_write(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5R_type_t src_type, H5VL_object_t *dst_file_obj, void *dst_buf, + size_t dst_size, void *bg_buf); + +static herr_t H5T__ref_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull); +static herr_t H5T__ref_disk_setnull(H5VL_object_t *dst_file_obj, void *dst_buf, void *bg_buf); +static size_t H5T__ref_disk_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); +static herr_t H5T__ref_disk_write(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5R_type_t src_type, H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size, void *bg_buf); /* For compatibility */ -static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull); -static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); - -static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, +static herr_t H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, + hbool_t *isnull); +static size_t H5T__ref_obj_disk_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_obj_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); + +static herr_t H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull); -static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, hbool_t *dst_copy); -static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size); +static size_t H5T__ref_dsetreg_disk_getsize(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, hbool_t *dst_copy); +static herr_t H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size); /*******************/ /* Local Variables */ @@ -156,7 +157,7 @@ static const H5T_ref_class_t H5T_ref_dsetreg_disk_g = { *------------------------------------------------------------------------- */ htri_t -H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) +H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file_obj, H5T_loc_t loc) { htri_t ret_value = FALSE; /* Indicate success, but no location change */ @@ -168,7 +169,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ - if (loc == dt->shared->u.atomic.u.r.loc && file == dt->shared->u.atomic.u.r.file) + if (loc == dt->shared->u.atomic.u.r.loc && file_obj == dt->shared->u.atomic.u.r.file_obj) HGOTO_DONE(FALSE) switch (loc) { @@ -188,7 +189,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) } /* end if */ /* Reset file ID (since this reference is in memory) */ - dt->shared->u.atomic.u.r.file = file; /* file is NULL */ + dt->shared->u.atomic.u.r.file_obj = file_obj; /* file is NULL */ if (dt->shared->u.atomic.u.r.opaque) { /* Size in memory, disk size is different */ @@ -219,16 +220,16 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) break; case H5T_LOC_DISK: /* Disk based reference datatype */ - HDassert(file); + HDassert(file_obj); /* Mark this type as being stored on disk */ dt->shared->u.atomic.u.r.loc = H5T_LOC_DISK; - /* Set file pointer (since this reference is on disk) */ - dt->shared->u.atomic.u.r.file = file; + /* Set VOL file object (since this reference is on disk) */ + dt->shared->u.atomic.u.r.file_obj = file_obj; /* dt now owns a reference to file */ - if (H5T_own_vol_obj(dt, file) < 0) + if (H5T_own_vol_obj(dt, file_obj) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object") if (dt->shared->u.atomic.u.r.rtype == H5R_OBJECT1) { @@ -239,7 +240,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(file, &is_native) < 0) + if (H5VL_object_is_native(file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") @@ -249,7 +250,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (f = (H5F_t *)H5VL_object_data(file))) + if (NULL == (f = (H5F_t *)H5VL_object_data(file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Size on disk, memory size is different */ @@ -267,7 +268,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) hbool_t is_native = FALSE; /* Whether the file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(file, &is_native) < 0) + if (H5VL_object_is_native(file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") @@ -277,7 +278,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (f = (H5F_t *)H5VL_object_data(file))) + if (NULL == (f = (H5F_t *)H5VL_object_data(file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Size on disk, memory size is different */ @@ -298,7 +299,7 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) vol_cb_args.args.get_cont_info.info = &cont_info; /* Get container info */ - if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5VL_file_get(file_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") /* Retrieve min encode size (when references have no vlen part) */ @@ -327,8 +328,8 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) */ dt->shared->u.atomic.u.r.loc = H5T_LOC_BADLOC; - /* Reset file pointer */ - dt->shared->u.atomic.u.r.file = NULL; + /* Reset VOL file object */ + dt->shared->u.atomic.u.r.file_obj = NULL; /* Reset the function pointers */ dt->shared->u.atomic.u.r.cls = NULL; @@ -357,7 +358,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, hbool_t *isnull) { const unsigned char zeros[H5T_REF_MEM_SIZE] = {0}; herr_t ret_value = SUCCEED; @@ -384,7 +385,7 @@ H5T__ref_mem_isnull(const H5VL_object_t H5_ATTR_UNUSED *src_file, const void *sr *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, H5_ATTR_UNUSED void *bg_buf) +H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, H5_ATTR_UNUSED void *bg_buf) { herr_t ret_value = SUCCEED; @@ -406,8 +407,8 @@ H5T__ref_mem_setnull(H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, H5_A *------------------------------------------------------------------------- */ static size_t -H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, - size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file, hbool_t *dst_copy) +H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file_obj, hbool_t *dst_copy) { H5VL_object_t * vol_obj = NULL; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; @@ -423,7 +424,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf HDassert(src_buf); HDassert(src_size == H5T_REF_MEM_SIZE); - if (NULL != dst_file) { + if (NULL != dst_file_obj) { hbool_t files_equal = TRUE; /* Whether src & dst references are in same file */ /* Retrieve VOL object */ @@ -431,7 +432,7 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if (H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) + if (H5VL_file_is_same(vol_obj, dst_file_obj, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, 0, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; } @@ -449,14 +450,14 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(dst_file, &is_native) < 0) + if (H5VL_object_is_native(dst_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Set the file's libver bounds if using the native VOL connector */ if (is_native) { H5F_t *dst_f; /* Native file struct */ - if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") H5CX_set_libver_bounds(dst_f); } /* end if */ @@ -523,8 +524,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t H5_ATTR_UNUSED src_size, - H5VL_object_t *dst_file, void *dst_buf, size_t dst_size) +H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size) { H5VL_object_t * vol_obj; /* VOL object for src ref's location */ const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf; @@ -546,7 +547,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s HDassert(dst_size); /* Memory-to-memory conversion to support vlen conversion */ - if (NULL == dst_file) { + if (NULL == dst_file_obj) { H5MM_memcpy(dst_buf, src_buf, dst_size); HGOTO_DONE(ret_value); } @@ -556,7 +557,7 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid location identifier") /* Set external flag if referenced file is not destination file */ - if (H5VL_file_is_same(vol_obj, dst_file, &files_equal) < 0) + if (H5VL_file_is_same(vol_obj, dst_file_obj, &files_equal) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCOMPARE, FAIL, "can't check if files are equal") flags |= !files_equal ? H5R_IS_EXTERNAL : 0; @@ -566,14 +567,14 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s hbool_t is_native = FALSE; /* Whether the dest. file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(dst_file, &is_native) < 0) + if (H5VL_object_is_native(dst_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Set the file's libver bounds if using the native VOL connector */ if (is_native) { H5F_t *dst_f; - if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file))) + if (NULL == (dst_f = (H5F_t *)H5VL_object_data(dst_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") H5CX_set_libver_bounds(dst_f); } /* end if */ @@ -637,8 +638,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size, H5R_type_t src_type, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size, +H5T__ref_mem_write(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, H5R_type_t src_type, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, size_t dst_size, void H5_ATTR_UNUSED *bg_buf) { H5F_t * src_f = NULL; @@ -658,7 +659,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size HDcompile_assert(sizeof(*dst_ref) == sizeof(tmp_ref)); /* Memory-to-memory conversion to support vlen conversion */ - if (NULL == src_file) { + if (NULL == src_file_obj) { H5MM_memcpy(dst_buf, src_buf, src_size); HGOTO_DONE(ret_value); } @@ -668,7 +669,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -677,7 +678,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Make sure reference buffer is correctly initialized */ @@ -726,7 +727,7 @@ H5T__ref_mem_write(H5VL_object_t *src_file, const void *src_buf, size_t src_size /* If no filename set, this is not an external reference */ if (NULL == H5R_REF_FILENAME(&tmp_ref)) { /* TODO temporary hack to retrieve file object */ - if ((file_id = H5F_get_file_id(src_file, H5I_FILE, FALSE)) < 0) + if ((file_id = H5F_get_file_id(src_file_obj, H5I_FILE, FALSE)) < 0) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object") /* Attach loc ID to reference and hold reference to it, this is a @@ -754,7 +755,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull) { const uint8_t *p = (const uint8_t *)src_buf; H5R_type_t ref_type; @@ -764,7 +765,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(isnull); @@ -785,7 +786,7 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t vol_cb_args.args.is_null.isnull = isnull; /* Check if blob ID is "nil" */ - if (H5VL_blob_specific(src_file, (void *)p, &vol_cb_args) < 0) + if (H5VL_blob_specific(src_file_obj, (void *)p, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") } @@ -803,7 +804,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) +H5T__ref_disk_setnull(H5VL_object_t *dst_file_obj, void *dst_buf, void *bg_buf) { H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */ uint8_t * q = (uint8_t *)dst_buf; @@ -813,7 +814,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(dst_file); + HDassert(dst_file_obj); HDassert(dst_buf); /* TODO Should get rid of bg stuff */ @@ -825,7 +826,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) vol_cb_args.op_type = H5VL_BLOB_DELETE; /* Remove blob for old data */ - if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0) + if (H5VL_blob_specific(dst_file_obj, (void *)p_bg, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") } /* end if */ @@ -840,7 +841,7 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf) vol_cb_args.op_type = H5VL_BLOB_SETNULL; /* Set blob ID to "nil" */ - if (H5VL_blob_specific(dst_file, q, &vol_cb_args) < 0) + if (H5VL_blob_specific(dst_file_obj, q, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") done: @@ -857,8 +858,8 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, hbool_t *dst_copy) +H5T__ref_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, hbool_t *dst_copy) { const uint8_t *p = (const uint8_t *)src_buf; unsigned flags; @@ -906,8 +907,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_NDEBUG_UNUSED src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t dst_size) +H5T__ref_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t H5_ATTR_NDEBUG_UNUSED src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, size_t dst_size) { const uint8_t *p = (const uint8_t *)src_buf; uint8_t * q = (uint8_t *)dst_buf; @@ -917,7 +918,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(dst_buf); HDassert(dst_size); @@ -933,7 +934,7 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_ HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T)); /* Retrieve blob */ - if (H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0) + if (H5VL_blob_get(src_file_obj, p, q, blob_size, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") done: @@ -950,8 +951,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, size_t src_size, - H5R_type_t H5_ATTR_UNUSED src_type, H5VL_object_t *dst_file, void *dst_buf, +H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void *src_buf, size_t src_size, + H5R_type_t H5_ATTR_UNUSED src_type, H5VL_object_t *dst_file_obj, void *dst_buf, size_t dst_size, void *bg_buf) { const uint8_t *p = (const uint8_t *)src_buf; @@ -965,7 +966,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, HDassert(src_buf); HDassert(src_size); - HDassert(dst_file); + HDassert(dst_file_obj); HDassert(dst_buf); /* TODO Should get rid of bg stuff */ @@ -982,7 +983,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, vol_cb_args.op_type = H5VL_BLOB_DELETE; /* Remove blob for old data */ - if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0) + if (H5VL_blob_specific(dst_file_obj, (void *)p_bg, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") } /* end if */ @@ -999,7 +1000,7 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, buf_size_left -= H5_SIZEOF_UINT32_T; /* Store blob */ - if (H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0) + if (H5VL_blob_put(dst_file_obj, p, src_size, q, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") done: @@ -1016,7 +1017,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull) { H5F_t * src_f; const uint8_t *p = (const uint8_t *)src_buf; @@ -1027,7 +1028,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(isnull); @@ -1036,7 +1037,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1045,7 +1046,7 @@ H5T__ref_obj_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbo #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Get the object address */ @@ -1068,8 +1069,8 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *src_buf, - size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, +H5T__ref_obj_disk_getsize(H5VL_object_t *src_file_obj, const void H5_ATTR_UNUSED *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, hbool_t H5_ATTR_UNUSED *dst_copy) { H5F_t *src_f; @@ -1078,7 +1079,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); #ifndef NDEBUG @@ -1086,7 +1087,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1095,7 +1096,7 @@ H5T__ref_obj_disk_getsize(H5VL_object_t *src_file, const void H5_ATTR_UNUSED *sr #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); @@ -1116,8 +1117,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) +H5T__ref_obj_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, + size_t H5_ATTR_UNUSED dst_size) { H5F_t *src_f; herr_t ret_value = SUCCEED; @@ -1125,7 +1127,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(dst_buf); @@ -1134,7 +1136,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1143,7 +1145,7 @@ H5T__ref_obj_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_ #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") HDassert(src_size == H5T_REF_OBJ_DISK_SIZE(src_f)); @@ -1168,7 +1170,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t *isnull) +H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file_obj, const void *src_buf, hbool_t *isnull) { H5F_t * src_f; const uint8_t *p = (const uint8_t *)src_buf; @@ -1179,7 +1181,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, H5T_REF_LOG_DEBUG(""); /* Check parameters */ - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(isnull); @@ -1188,7 +1190,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1197,7 +1199,7 @@ H5T__ref_dsetreg_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") /* Get the heap address */ @@ -1220,8 +1222,8 @@ done: *------------------------------------------------------------------------- */ static size_t -H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void H5_ATTR_UNUSED *src_buf, - size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file, +H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file_obj, const void H5_ATTR_UNUSED *src_buf, + size_t H5_ATTR_UNUSED src_size, H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, hbool_t H5_ATTR_UNUSED *dst_copy) { size_t ret_value = sizeof(struct H5Tref_dsetreg); @@ -1241,14 +1243,14 @@ H5T__ref_dsetreg_disk_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ HDassert(is_native); /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid VOL object") HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); @@ -1271,8 +1273,8 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t src_size, - H5VL_object_t H5_ATTR_UNUSED *dst_file, void *dst_buf, +H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file_obj, const void *src_buf, size_t src_size, + H5VL_object_t H5_ATTR_UNUSED *dst_file_obj, void *dst_buf, size_t H5_ATTR_UNUSED dst_size) { H5F_t * src_f; @@ -1282,7 +1284,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t FUNC_ENTER_STATIC H5T_REF_LOG_DEBUG(""); - HDassert(src_file); + HDassert(src_file_obj); HDassert(src_buf); HDassert(dst_buf); HDassert(dst_size == sizeof(struct H5Tref_dsetreg)); @@ -1292,7 +1294,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t hbool_t is_native = FALSE; /* Whether the src file is using the native VOL connector */ /* Check if using native VOL connector */ - if (H5VL_object_is_native(src_file, &is_native) < 0) + if (H5VL_object_is_native(src_file_obj, H5VL_GET_CONN_LVL_TERM, &is_native) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't query if file uses native VOL connector") /* Must use native VOL connector for this operation */ @@ -1301,7 +1303,7 @@ H5T__ref_dsetreg_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t #endif /* NDEBUG */ /* Retrieve file from VOL object */ - if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file))) + if (NULL == (src_f = (H5F_t *)H5VL_object_data(src_file_obj))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid VOL object") HDassert(src_size == H5T_REF_DSETREG_DISK_SIZE(src_f)); diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c index 080d725..ee32bf3 100644 --- a/src/H5Tvlen.c +++ b/src/H5Tvlen.c @@ -52,31 +52,31 @@ /********************/ /* Memory-based VL sequence callbacks */ -static herr_t H5T__vlen_mem_seq_getlen(H5VL_object_t *file, const void *_vl, size_t *len); +static herr_t H5T__vlen_mem_seq_getlen(H5VL_object_t *file_obj, const void *_vl, size_t *len); static void * H5T__vlen_mem_seq_getptr(void *_vl); -static herr_t H5T__vlen_mem_seq_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_mem_seq_setnull(H5VL_object_t *file, void *_vl, void *_bg); -static herr_t H5T__vlen_mem_seq_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_mem_seq_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +static herr_t H5T__vlen_mem_seq_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_mem_seq_setnull(H5VL_object_t *file_obj, void *_vl, void *_bg); +static herr_t H5T__vlen_mem_seq_read(H5VL_object_t *file_obj, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_mem_seq_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); /* Memory-based VL string callbacks */ -static herr_t H5T__vlen_mem_str_getlen(H5VL_object_t *file, const void *_vl, size_t *len); +static herr_t H5T__vlen_mem_str_getlen(H5VL_object_t *file_obj, const void *_vl, size_t *len); static void * H5T__vlen_mem_str_getptr(void *_vl); -static herr_t H5T__vlen_mem_str_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_mem_str_setnull(H5VL_object_t *file, void *_vl, void *_bg); -static herr_t H5T__vlen_mem_str_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_mem_str_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +static herr_t H5T__vlen_mem_str_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_mem_str_setnull(H5VL_object_t *file_obj, void *_vl, void *_bg); +static herr_t H5T__vlen_mem_str_read(H5VL_object_t *file_obj, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_mem_str_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); /* Disk-based VL sequence (and string) callbacks */ -static herr_t H5T__vlen_disk_getlen(H5VL_object_t *file, const void *_vl, size_t *len); -static herr_t H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull); -static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *_bg); -static herr_t H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *_buf, size_t len); -static herr_t H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, - void *_buf, void *_bg, size_t seq_len, size_t base_size); -static herr_t H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl); +static herr_t H5T__vlen_disk_getlen(H5VL_object_t *file_obj, const void *_vl, size_t *len); +static herr_t H5T__vlen_disk_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull); +static herr_t H5T__vlen_disk_setnull(H5VL_object_t *file_obj, void *_vl, void *_bg); +static herr_t H5T__vlen_disk_read(H5VL_object_t *file_obj, void *_vl, void *_buf, size_t len); +static herr_t H5T__vlen_disk_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, + void *_vl, void *_buf, void *_bg, size_t seq_len, size_t base_size); +static herr_t H5T__vlen_disk_delete(H5VL_object_t *file_obj, const void *_vl); /*********************/ /* Public Variables */ @@ -245,7 +245,7 @@ done: *------------------------------------------------------------------------- */ htri_t -H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) +H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file_obj, H5T_loc_t loc) { htri_t ret_value = FALSE; /* Indicate success, but no location change */ @@ -256,10 +256,10 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) HDassert(loc >= H5T_LOC_BADLOC && loc < H5T_LOC_MAXLOC); /* Only change the location if it's different */ - if (loc != dt->shared->u.vlen.loc || file != dt->shared->u.vlen.file) { + if (loc != dt->shared->u.vlen.loc || file_obj != dt->shared->u.vlen.file_obj) { switch (loc) { case H5T_LOC_MEMORY: /* Memory based VL datatype */ - HDassert(NULL == file); + HDassert(NULL == file_obj); /* Mark this type as being stored in memory */ dt->shared->u.vlen.loc = H5T_LOC_MEMORY; @@ -288,8 +288,8 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) dt->shared->owned_vol_obj = NULL; } /* end if */ - /* Reset file pointer (since this VL is in memory) */ - dt->shared->u.vlen.file = NULL; + /* Reset VOL object (since this VL is in memory) */ + dt->shared->u.vlen.file_obj = NULL; break; /* Disk based VL datatype */ @@ -297,7 +297,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0}; H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */ - HDassert(file); + HDassert(file_obj); /* Mark this type as being stored on disk */ dt->shared->u.vlen.loc = H5T_LOC_DISK; @@ -307,7 +307,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) vol_cb_args.args.get_cont_info.info = &cont_info; /* Get container info */ - if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) + if (H5VL_file_get(file_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info") /* The datatype size is equal to 4 bytes for the sequence length @@ -318,11 +318,11 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* VL sequences and VL strings are stored identically on disk, so use the same functions */ dt->shared->u.vlen.cls = &H5T_vlen_disk_g; - /* Set file ID (since this VL is on disk) */ - dt->shared->u.vlen.file = file; + /* Set VOL object (since this VL is on disk) */ + dt->shared->u.vlen.file_obj = file_obj; /* dt now owns a reference to file */ - if (H5T_own_vol_obj(dt, file) < 0) + if (H5T_own_vol_obj(dt, file_obj) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object") break; } @@ -336,8 +336,8 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc) /* Reset the function pointers to access the VL information */ dt->shared->u.vlen.cls = NULL; - /* Reset file pointer */ - dt->shared->u.vlen.file = NULL; + /* Reset VOL object pointer */ + dt->shared->u.vlen.file_obj = NULL; break; case H5T_LOC_MAXLOC: @@ -367,7 +367,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len) +H5T__vlen_mem_seq_getlen(H5VL_object_t H5_ATTR_UNUSED *file_obj, const void *_vl, size_t *len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -441,7 +441,7 @@ H5T__vlen_mem_seq_getptr(void *_vl) *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull) +H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, hbool_t *isnull) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -478,7 +478,7 @@ H5T__vlen_mem_seq_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg) +H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void H5_ATTR_UNUSED *_bg) { hvl_t vl; /* Temporary hvl_t to use during operation */ @@ -510,7 +510,7 @@ H5T__vlen_mem_seq_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) +H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void *buf, size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const hvl_t *vl = (const hvl_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -550,7 +550,7 @@ H5T__vlen_mem_seq_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +H5T__vlen_mem_seq_write(H5VL_object_t H5_ATTR_UNUSED *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { hvl_t vl; /* Temporary hvl_t to use during operation */ @@ -604,7 +604,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *len) +H5T__vlen_mem_str_getlen(H5VL_object_t H5_ATTR_UNUSED *file_obj, const void *_vl, size_t *len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS const char *s = *(const char *const *)_vl; /* Pointer to the user's string information */ @@ -673,7 +673,7 @@ H5T__vlen_mem_str_getptr(void *_vl) *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hbool_t *isnull) +H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, hbool_t *isnull) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -705,7 +705,7 @@ H5T__vlen_mem_str_isnull(const H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, hb *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5_ATTR_UNUSED *_bg) +H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void H5_ATTR_UNUSED *_bg) { char *t = NULL; /* Pointer to temporary buffer allocated */ @@ -730,7 +730,7 @@ H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5 *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, size_t len) +H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file_obj, void *_vl, void *buf, size_t len) { #ifdef H5_NO_ALIGNMENT_RESTRICTIONS char *s = *(char **)_vl; /* Pointer to the user's string information */ @@ -769,7 +769,7 @@ H5T__vlen_mem_str_read(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void *buf, *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc_info_t *vl_alloc_info, +H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file_obj, const H5T_vlen_alloc_info_t *vl_alloc_info, void *_vl, void *buf, void H5_ATTR_UNUSED *_bg, size_t seq_len, size_t base_size) { char * t; /* Pointer to temporary buffer allocated */ @@ -817,7 +817,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_t *seq_len) +H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file_obj, const void *_vl, size_t *seq_len) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -846,7 +846,7 @@ H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_ *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) +H5T__vlen_disk_isnull(const H5VL_object_t *file_obj, void *_vl, hbool_t *isnull) { H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -855,7 +855,7 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) FUNC_ENTER_STATIC /* Check parameters */ - HDassert(file); + HDassert(file_obj); HDassert(vl); HDassert(isnull); @@ -867,7 +867,7 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull) vol_cb_args.args.is_null.isnull = isnull; /* Check if blob ID is "nil" */ - if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0) + if (H5VL_blob_specific(file_obj, vl, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'") done: @@ -887,7 +887,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) +H5T__vlen_disk_setnull(H5VL_object_t *file_obj, void *_vl, void *bg) { H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -896,13 +896,13 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) FUNC_ENTER_STATIC /* check parameters */ - HDassert(file); + HDassert(file_obj); HDassert(vl); /* Free heap object for old data */ if (bg != NULL) /* Delete sequence in destination location */ - if (H5T__vlen_disk_delete(file, bg) < 0) + if (H5T__vlen_disk_delete(file_obj, bg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") /* Set the length of the sequence */ @@ -912,7 +912,7 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg) vol_cb_args.op_type = H5VL_BLOB_SETNULL; /* Set blob ID to "nil" */ - if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0) + if (H5VL_blob_specific(file_obj, vl, &vol_cb_args) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'") done: @@ -932,7 +932,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) +H5T__vlen_disk_read(H5VL_object_t *file_obj, void *_vl, void *buf, size_t len) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ herr_t ret_value = SUCCEED; /* Return value */ @@ -940,7 +940,7 @@ H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) FUNC_ENTER_STATIC /* Check parameters */ - HDassert(file); + HDassert(file_obj); HDassert(vl); HDassert(buf); @@ -948,7 +948,7 @@ H5T__vlen_disk_read(H5VL_object_t *file, void *_vl, void *buf, size_t len) vl += 4; /* Retrieve blob */ - if (H5VL_blob_get(file, vl, buf, len, NULL) < 0) + if (H5VL_blob_get(file_obj, vl, buf, len, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get blob") done: @@ -968,7 +968,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, +H5T__vlen_disk_write(H5VL_object_t *file_obj, const H5T_vlen_alloc_info_t H5_ATTR_UNUSED *vl_alloc_info, void *_vl, void *buf, void *_bg, size_t seq_len, size_t base_size) { uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */ @@ -980,18 +980,18 @@ H5T__vlen_disk_write(H5VL_object_t *file, const H5T_vlen_alloc_info_t H5_ATTR_UN /* check parameters */ HDassert(vl); HDassert(seq_len == 0 || buf); - HDassert(file); + HDassert(file_obj); /* Free heap object for old data, if non-NULL */ if (bg != NULL) - if (H5T__vlen_disk_delete(file, bg) < 0) + if (H5T__vlen_disk_delete(file_obj, bg) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to remove background heap object") /* Set the length of the sequence */ UINT32ENCODE(vl, seq_len); /* Store blob */ - if (H5VL_blob_put(file, buf, (seq_len * base_size), vl, NULL) < 0) + if (H5VL_blob_put(file_obj, buf, (seq_len * base_size), vl, NULL) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to put blob") done: @@ -1011,7 +1011,7 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl) +H5T__vlen_disk_delete(H5VL_object_t *file_obj, const void *_vl) { const uint8_t *vl = (const uint8_t *)_vl; /* Pointer to the user's hvl_t information */ herr_t ret_value = SUCCEED; /* Return value */ @@ -1019,7 +1019,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl) FUNC_ENTER_STATIC /* Check parameters */ - HDassert(file); + HDassert(file_obj); /* Free heap object for old data */ if (vl != NULL) { @@ -1035,7 +1035,7 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl) /* Set up VOL callback arguments */ vol_cb_args.op_type = H5VL_BLOB_DELETE; - if (H5VL_blob_specific(file, (void *)vl, &vol_cb_args) < 0) /* Casting away 'const' OK -QAK */ + if (H5VL_blob_specific(file_obj, (void *)vl, &vol_cb_args) < 0) /* Casting away 'const' OK -QAK */ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob") } /* end if */ } /* end if */ @@ -686,7 +686,7 @@ H5VLget_file_type(void *file_obj, hid_t connector_id, hid_t dtype_id) /* Create VOL object for file if necessary (force_conv will be TRUE if and * only if file needs to be passed to H5T_set_loc) */ if (H5T_GET_FORCE_CONV(dtype) && - (NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id)))) + (NULL == (file_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file_obj, connector_id, TRUE)))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create VOL object") /* Copy the datatype */ diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c index a61b003..0349874 100644 --- a/src/H5VLcallback.c +++ b/src/H5VLcallback.c @@ -28,6 +28,8 @@ /***********/ #include "H5private.h" /* Generic Functions */ +#include "H5CXprivate.h" /* API Contexts */ +#include "H5Dprivate.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5ESprivate.h" /* Event Sets */ #include "H5Fprivate.h" /* File access */ @@ -60,6 +62,541 @@ typedef struct H5VL_file_open_find_connector_t { 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); +/* Typedef for common callback form of API operations */ +typedef herr_t (*H5VL_api_oper_t)(void *ctx); + +/* + * Context data structures for common callbacks for API operations + */ + +/* Attribute create "common" callback context data */ +typedef struct H5VL_attr_create_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t type_id; + hid_t space_id; + hid_t acpl_id; + hid_t aapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_attr_create_ctx_t; + +/* Attribute open "common" callback context data */ +typedef struct H5VL_attr_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t aapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_attr_open_ctx_t; + +/* Attribute read "common" callback context data */ +typedef struct H5VL_attr_read_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_attr_read_ctx_t; + +/* Attribute write "common" callback context data */ +typedef struct H5VL_attr_write_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + const void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_attr_write_ctx_t; + +/* Attribute get "common" callback context data */ +typedef struct H5VL_attr_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_attr_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_attr_get_ctx_t; + +/* Attribute specific "common" callback context data */ +typedef struct H5VL_attr_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t * loc_params; + H5VL_class_t * cls; + H5VL_attr_specific_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_attr_specific_ctx_t; + +/* Attribute optional "common" callback context data */ +typedef struct H5VL_attr_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_attr_optional_ctx_t; + +/* Attribute close "common" callback context data */ +typedef struct H5VL_attr_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_attr_close_ctx_t; + +/* Dataset create "common" callback context data */ +typedef struct H5VL_dataset_create_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t lcpl_id; + hid_t type_id; + hid_t space_id; + hid_t dcpl_id; + hid_t dapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_dataset_create_ctx_t; + +/* Dataset open "common" callback context data */ +typedef struct H5VL_dataset_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t dapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_dataset_open_ctx_t; + +/* Dataset read "common" callback context data */ +typedef struct H5VL_dataset_read_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + hid_t mem_space_id; + hid_t file_space_id; + void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_read_ctx_t; + +/* Dataset write "common" callback context data */ +typedef struct H5VL_dataset_write_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t mem_type_id; + hid_t mem_space_id; + hid_t file_space_id; + const void * buf; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_write_ctx_t; + +/* Dataset get "common" callback context data */ +typedef struct H5VL_dataset_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_dataset_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_get_ctx_t; + +/* Dataset specific "common" callback context data */ +typedef struct H5VL_dataset_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_dataset_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_specific_ctx_t; + +/* Dataset optional "common" callback context data */ +typedef struct H5VL_dataset_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_optional_ctx_t; + +/* Dataset close "common" callback context data */ +typedef struct H5VL_dataset_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_dataset_close_ctx_t; + +/* Named datatype commit "common" callback context data */ +typedef struct H5VL_datatype_commit_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + 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; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_datatype_commit_ctx_t; + +/* Named datatype open "common" callback context data */ +typedef struct H5VL_datatype_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t tapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_datatype_open_ctx_t; + +/* Datatype get "common" callback context data */ +typedef struct H5VL_datatype_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_datatype_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_get_ctx_t; + +/* Datatype specific "common" callback context data */ +typedef struct H5VL_datatype_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_datatype_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_specific_ctx_t; + +/* Datatype optional "common" callback context data */ +typedef struct H5VL_datatype_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_optional_ctx_t; + +/* Datatype close "common" callback context data */ +typedef struct H5VL_datatype_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_datatype_close_ctx_t; + +/* File get "common" callback context data */ +typedef struct H5VL_file_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_file_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_file_get_ctx_t; + +/* File specific "common" callback context data */ +typedef struct H5VL_file_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_file_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_file_specific_ctx_t; + +/* File optional "common" callback context data */ +typedef struct H5VL_file_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_file_optional_ctx_t; + +/* File close "common" callback context data */ +typedef struct H5VL_file_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_file_close_ctx_t; + +/* Group create "common" callback context data */ +typedef struct H5VL_group_create_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + 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; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_group_create_ctx_t; + +/* Group open "common" callback context data */ +typedef struct H5VL_group_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + const char * name; + hid_t gapl_id; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_group_open_ctx_t; + +/* Group get "common" callback context data */ +typedef struct H5VL_group_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_group_get_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_group_get_ctx_t; + +/* Group specific "common" callback context data */ +typedef struct H5VL_group_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_group_specific_args_t *args; + hid_t dxpl_id; + void ** req; +} H5VL_group_specific_ctx_t; + +/* Group optional "common" callback context data */ +typedef struct H5VL_group_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t * cls; + H5VL_optional_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_group_optional_ctx_t; + +/* Group close "common" callback context data */ +typedef struct H5VL_group_close_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + H5VL_class_t *cls; + hid_t dxpl_id; + void ** req; +} H5VL_group_close_ctx_t; + +/* Link create "common" callback context data */ +typedef struct H5VL_link_create_ctx_t { + /* DOWN: API routine parameters */ + H5VL_link_create_args_t *args; + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + hid_t lcpl_id; + hid_t lapl_id; + hid_t dxpl_id; + void ** req; +} H5VL_link_create_ctx_t; + +/* Link copy "common" callback context data */ +typedef struct H5VL_link_copy_ctx_t { + /* DOWN: API routine parameters */ + void * src_obj; + const H5VL_loc_params_t *src_loc_params; + void * dst_obj; + const H5VL_loc_params_t *dst_loc_params; + H5VL_class_t * cls; + hid_t lcpl_id; + hid_t lapl_id; + hid_t dxpl_id; + void ** req; +} H5VL_link_copy_ctx_t; + +/* Link move "common" callback context data */ +typedef struct H5VL_link_move_ctx_t { + /* DOWN: API routine parameters */ + void * src_obj; + const H5VL_loc_params_t *src_loc_params; + void * dst_obj; + const H5VL_loc_params_t *dst_loc_params; + H5VL_class_t * cls; + hid_t lcpl_id; + hid_t lapl_id; + hid_t dxpl_id; + void ** req; +} H5VL_link_move_ctx_t; + +/* Link get "common" callback context data */ +typedef struct H5VL_link_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_link_get_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_link_get_ctx_t; + +/* Link specific "common" callback context data */ +typedef struct H5VL_link_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t * loc_params; + H5VL_class_t * cls; + H5VL_link_specific_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_link_specific_ctx_t; + +/* Link optional "common" callback context data */ +typedef struct H5VL_link_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_optional_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_link_optional_ctx_t; + +/* Object open "common" callback context data */ +typedef struct H5VL_object_open_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5I_type_t * opened_type; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + void *ret_value; +} H5VL_object_open_ctx_t; + +/* Object copy "common" callback context data */ +typedef struct H5VL_object_copy_ctx_t { + /* DOWN: API routine parameters */ + void * src_obj; + const H5VL_loc_params_t *src_loc_params; + const char * src_name; + void * dst_obj; + const H5VL_loc_params_t *dst_loc_params; + const char * dst_name; + H5VL_class_t * cls; + hid_t ocpypl_id; + hid_t lcpl_id; + hid_t dxpl_id; + void ** req; +} H5VL_object_copy_ctx_t; + +/* Object get "common" callback context data */ +typedef struct H5VL_object_get_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_object_get_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_object_get_ctx_t; + +/* Object specific "common" callback context data */ +typedef struct H5VL_object_specific_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t * loc_params; + H5VL_class_t * cls; + H5VL_object_specific_args_t *args; + hid_t dxpl_id; + void ** req; + + /* UP: API routine return value */ + herr_t ret_value; +} H5VL_object_specific_ctx_t; + +/* Object optional "common" callback context data */ +typedef struct H5VL_object_optional_ctx_t { + /* DOWN: API routine parameters */ + void * obj; + const H5VL_loc_params_t *loc_params; + H5VL_class_t * cls; + H5VL_optional_args_t * args; + hid_t dxpl_id; + void ** req; +} H5VL_object_optional_ctx_t; + /********************/ /* Package Typedefs */ /********************/ @@ -70,47 +607,69 @@ typedef herr_t (*H5VL_reg_opt_oper_t)(void *obj, const H5VL_class_t *cls, H5VL_o static void * H5VL__attr_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_create_api_op(void *ctx); static void * H5VL__attr_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_open_api_op(void *ctx); static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_read_api_op(void *ctx); 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_write_api_op(void *ctx); 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_get_api_op(void *ctx); static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_specific_api_op(void *ctx); 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_optional_api_op(void *ctx); static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__attr_close_api_op(void *ctx); 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, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_create_api_op(void *ctx); static void * H5VL__dataset_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_open_api_op(void *ctx); static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void **req); +static herr_t H5VL__dataset_read_api_op(void *ctx); 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_write_api_op(void *ctx); 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_get_api_op(void *ctx); 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_specific_api_op(void *ctx); 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_optional_api_op(void *ctx); static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__dataset_close_api_op(void *ctx); 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 herr_t H5VL__datatype_commit_api_op(void *ctx); 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_open_api_op(void *ctx); 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_get_api_op(void *ctx); 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_specific_api_op(void *ctx); 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_optional_api_op(void *ctx); static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__datatype_close_api_op(void *ctx); 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); static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fapl_id, @@ -119,50 +678,71 @@ static herr_t H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const v void *op_data); 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_get_api_op(void *ctx); 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_specific_api_op(void *ctx); 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_optional_api_op(void *ctx); static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__file_close_api_op(void *ctx); 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 herr_t H5VL__group_create_api_op(void *ctx); 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_open_api_op(void *ctx); 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_get_api_op(void *ctx); 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_specific_api_op(void *ctx); 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_optional_api_op(void *ctx); static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req); +static herr_t H5VL__group_close_api_op(void *ctx); 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, +static herr_t H5VL__link_create_api_op(void *ctx); +static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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_api_op(void *ctx); static herr_t H5VL__link_move(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); +static herr_t H5VL__link_move_api_op(void *ctx); static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__link_get_api_op(void *ctx); static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__link_specific_api_op(void *ctx); 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 herr_t H5VL__link_optional_api_op(void *ctx); 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_open_api_op(void *ctx); static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, void *dst_obj, const H5VL_loc_params_t *dst_loc_params, const char *dst_name, const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req); +static herr_t H5VL__object_copy_api_op(void *ctx); static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_get_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__object_get_api_op(void *ctx); static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req); +static herr_t H5VL__object_specific_api_op(void *ctx); 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__object_optional_api_op(void *ctx); 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, @@ -219,7 +799,7 @@ H5VLinitialize(hid_t connector_id, hid_t vipl_id) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "ii", connector_id, vipl_id); /* Check args */ @@ -231,7 +811,7 @@ H5VLinitialize(hid_t connector_id, hid_t vipl_id) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not initialize") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLinitialize() */ /*------------------------------------------------------------------------- @@ -250,7 +830,7 @@ H5VLterminate(hid_t connector_id) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE1("e", "i", connector_id); /* Check args */ @@ -262,7 +842,7 @@ H5VLterminate(hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "VOL connector did not terminate cleanly") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLterminate() */ /*--------------------------------------------------------------------------- @@ -281,7 +861,7 @@ H5VLget_cap_flags(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 + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "ix", connector_id, cap_flags); /* Check args */ @@ -293,7 +873,7 @@ H5VLget_cap_flags(hid_t connector_id, unsigned *cap_flags /*out*/) *cap_flags = cls->cap_flags; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_cap_flags */ /*--------------------------------------------------------------------------- @@ -312,7 +892,7 @@ H5VLget_value(hid_t connector_id, H5VL_class_value_t *value /*out*/) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "ix", connector_id, value); /* Check args */ @@ -324,7 +904,7 @@ H5VLget_value(hid_t connector_id, H5VL_class_value_t *value /*out*/) *value = cls->value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_value */ /*------------------------------------------------------------------------- @@ -361,7 +941,7 @@ H5VL__common_optional_op(hid_t id, H5I_type_t id_type, H5VL_reg_opt_oper_t reg_o /* (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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -372,6 +952,68 @@ done: } /* end H5VL__common_optional_op() */ /*------------------------------------------------------------------------- + * Function: H5VL__common_api_op + * + * Purpose: Provide common wrapping for VOL callback API routines. + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__common_api_op(hid_t dxpl_id, H5VL_api_oper_t wrap_op, void *wrap_ctx) +{ + H5P_genplist_t *dxpl_plist = NULL; /* DXPL property list pointer */ + hbool_t new_api_ctx = FALSE; /* Whether to start a new API context */ + hbool_t api_pushed = FALSE; /* Indicate that a new API context was pushed */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Check for non-default DXPL */ + if (!(H5P_DEFAULT == dxpl_id || H5P_DATASET_XFER_DEFAULT == dxpl_id)) { + /* Check for 'new API context' flag */ + if (NULL == (dxpl_plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a dataset transfer property list") + if (H5P_get(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get value") + + /* Start a new API context, if requested */ + if (new_api_ctx) { + hbool_t reset_api_ctx = FALSE; /* Flag to reset the 'new API context' */ + + /* Push the API context */ + if (H5CX_push() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context") + api_pushed = TRUE; + + /* Reset 'new API context' flag for next layer down */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &reset_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set value") + } /* end if */ + } /* end if */ + + /* Call the corresponding internal common wrapper routine */ + if ((*wrap_op)(wrap_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation callback") + +done: + /* Pop the API context, if it was pushed */ + if (api_pushed) { + hbool_t undo_api_ctx = TRUE; /* Flag to reset the 'new API context' */ + + /* Undo change to 'new API context' flag */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &undo_api_ctx) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set value") + + (void)H5CX_pop(FALSE); + } /* end if */ + + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__common_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VL_copy_connector_info * * Purpose: Copy the VOL info for a connector @@ -431,7 +1073,7 @@ H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_i H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "i**x*x", connector_id, dst_vol_info, src_vol_info); /* Check args and get class pointer */ @@ -443,7 +1085,7 @@ H5VLcopy_connector_info(hid_t connector_id, void **dst_vol_info, void *src_vol_i HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy VOL connector info object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLcopy_connector_info() */ /*------------------------------------------------------------------------- @@ -593,7 +1235,7 @@ H5VLfree_connector_info(hid_t connector_id, void *info) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "i*x", connector_id, info); /* Free the VOL connector info object */ @@ -601,7 +1243,7 @@ H5VLfree_connector_info(hid_t connector_id, void *info) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector info object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLfree_connector_info() */ /*--------------------------------------------------------------------------- @@ -619,7 +1261,7 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xi**s", info, connector_id, str); /* Only serialize info object, if it's non-NULL */ @@ -642,7 +1284,7 @@ H5VLconnector_info_to_str(const void *info, hid_t connector_id, char **str) *str = NULL; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLconnector_info_to_str() */ /*--------------------------------------------------------------------------- @@ -660,7 +1302,7 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info /*out { herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*six", str, connector_id, info); /* Call internal routine */ @@ -668,7 +1310,7 @@ H5VLconnector_str_to_info(const char *str, hid_t connector_id, void **info /*out HGOTO_ERROR(H5E_VOL, H5E_CANTDECODE, FAIL, "can't deserialize connector info") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLconnector_str_to_info() */ /*--------------------------------------------------------------------------- @@ -687,7 +1329,7 @@ H5VLget_object(void *obj, hid_t connector_id) H5VL_class_t *cls; /* VOL connector's class struct */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE2("*x", "*xi", obj, connector_id); /* Check args */ @@ -703,7 +1345,7 @@ H5VLget_object(void *obj, hid_t connector_id) ret_value = obj; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_object */ /*------------------------------------------------------------------------- @@ -760,7 +1402,7 @@ H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx /*out*/) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xix", obj, connector_id, wrap_ctx); /* Check args and get class pointer */ @@ -772,7 +1414,7 @@ H5VLget_wrap_ctx(void *obj, hid_t connector_id, void **wrap_ctx /*out*/) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to retrieve VOL connector object wrap context") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLget_wrap_ctx() */ /*------------------------------------------------------------------------- @@ -825,7 +1467,7 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c H5VL_class_t *cls; /* VOL connector's class struct */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE4("*x", "*xIti*x", obj, obj_type, connector_id, wrap_ctx); /* Check args and get class pointer */ @@ -839,7 +1481,7 @@ H5VLwrap_object(void *obj, H5I_type_t obj_type, hid_t connector_id, void *wrap_c HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to wrap object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLwrap_object */ /*------------------------------------------------------------------------- @@ -892,7 +1534,7 @@ H5VLunwrap_object(void *obj, hid_t connector_id) H5VL_class_t *cls; /* VOL connector's class struct */ void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE2("*x", "*xi", obj, connector_id); /* Check args and get class pointer */ @@ -906,7 +1548,7 @@ H5VLunwrap_object(void *obj, hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to unwrap object") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLunwrap_object */ /*------------------------------------------------------------------------- @@ -956,7 +1598,7 @@ H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "*xi", wrap_ctx, connector_id); /* Check args and get class pointer */ @@ -968,7 +1610,7 @@ H5VLfree_wrap_ctx(void *wrap_ctx, hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to release VOL connector object wrap context") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* H5VLfree_wrap_ctx() */ /*------------------------------------------------------------------------- @@ -1040,6 +1682,37 @@ done: } /* end H5VL_attr_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_create_api_op + * + * Purpose: Callback for common API wrapper to create an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_create_api_op(void *_ctx) +{ + H5VL_attr_create_ctx_t *ctx = (H5VL_attr_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = + H5VL__attr_create(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, ctx->type_id, + ctx->space_id, ctx->acpl_id, ctx->aapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_create * * Purpose: Creates an attribute @@ -1054,10 +1727,11 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ hid_t type_id, hid_t space_id, hid_t acpl_id, hid_t aapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_attr_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE10("*x", "*x*#i*siiiiix", obj, loc_params, connector_id, name, type_id, space_id, acpl_id, aapl_id, dxpl_id, req); @@ -1067,13 +1741,28 @@ H5VLattr_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__attr_create(obj, loc_params, cls, name, type_id, space_id, acpl_id, - aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create attribute") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.type_id = type_id; + ctx.space_id = space_id; + ctx.acpl_id = acpl_id; + ctx.aapl_id = aapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_create() */ /*------------------------------------------------------------------------- @@ -1144,6 +1833,36 @@ done: } /* end H5VL_attr_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_open_api_op + * + * Purpose: Callback for common API wrapper to open an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_open_api_op(void *_ctx) +{ + H5VL_attr_open_ctx_t *ctx = (H5VL_attr_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__attr_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->aapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_open * * Purpose: Opens an attribute @@ -1157,10 +1876,11 @@ void * H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t aapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_attr_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, aapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1169,12 +1889,25 @@ H5VLattr_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__attr_open(obj, loc_params, cls, name, aapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open attribute") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.aapl_id = aapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_open() */ /*------------------------------------------------------------------------- @@ -1242,6 +1975,35 @@ done: } /* end H5VL_attr_read() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_read_api_op + * + * Purpose: Callback for common API wrapper to read an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_read_api_op(void *_ctx) +{ + H5VL_attr_read_ctx_t *ctx = (H5VL_attr_read_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_read(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->buf, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_read_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_read * * Purpose: Reads data from an attribute @@ -1254,10 +2016,11 @@ done: herr_t H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_read_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xii*xix", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ @@ -1266,12 +2029,20 @@ H5VLattr_read(void *obj, hid_t connector_id, hid_t mem_type_id, void *buf, hid_t 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__attr_read(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_READERROR, FAIL, "unable to read attribute") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_read_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_read() */ /*------------------------------------------------------------------------- @@ -1340,6 +2111,35 @@ done: } /* end H5VL_attr_write() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_write_api_op + * + * Purpose: Callback for common API wrapper to write an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_write_api_op(void *_ctx) +{ + H5VL_attr_write_ctx_t *ctx = (H5VL_attr_write_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_write(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->buf, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_write_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_write * * Purpose: Writes data to an attribute @@ -1353,10 +2153,11 @@ herr_t H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_write_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xii*xix", obj, connector_id, mem_type_id, buf, dxpl_id, req); /* Check args and get class pointer */ @@ -1365,18 +2166,26 @@ H5VLattr_write(void *obj, hid_t connector_id, hid_t mem_type_id, const void *buf 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__attr_write(obj, cls, mem_type_id, buf, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_WRITEERROR, FAIL, "unable to write attribute") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_write_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_write() */ /*------------------------------------------------------------------------- * Function: H5VL__attr_get * - * Purpose: Get specific information about the attribute through the VOL + * Purpose: Get information about the attribute through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -1405,7 +2214,7 @@ done: /*------------------------------------------------------------------------- * Function: H5VL_attr_get * - * Purpose: Get specific information about the attribute through the VOL + * Purpose: Get information about the attribute through the VOL * * Return: Success: Non-negative * Failure: Negative @@ -1438,6 +2247,35 @@ done: } /* end H5VL_attr_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_get_api_op + * + * Purpose: Callback for common API wrapper to get an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_get_api_op(void *_ctx) +{ + H5VL_attr_get_ctx_t *ctx = (H5VL_attr_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_get * * Purpose: Gets information about the attribute @@ -1450,10 +2288,11 @@ done: herr_t 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 */ + H5VL_attr_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -1464,12 +2303,19 @@ H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dx 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_get() */ /*------------------------------------------------------------------------- @@ -1542,6 +2388,34 @@ done: } /* end H5VL_attr_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_specific_api_op + * + * Purpose: Callback for common API wrapper for attribute specific operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_specific_api_op(void *_ctx) +{ + H5VL_attr_specific_ctx_t *ctx = (H5VL_attr_specific_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = + H5VL__attr_specific(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__attr_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_specific * * Purpose: Performs a connector-specific operation on an attribute @@ -1555,10 +2429,11 @@ herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, 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 */ + H5VL_attr_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -1567,13 +2442,25 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ - /* (Must return value from callback, for iterators) */ - if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0) + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_specific() */ /*------------------------------------------------------------------------- @@ -1600,7 +2487,7 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *ar /* Call the corresponding VOL 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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'optional' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -1632,7 +2519,7 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid /* Call the corresponding internal VOL routine */ /* (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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -1643,6 +2530,33 @@ done: } /* end H5VL_attr_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_optional_api_op + * + * Purpose: Callback for common API wrapper for attribute optional operation + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_optional_api_op(void *_ctx) +{ + H5VL_attr_optional_ctx_t *ctx = (H5VL_attr_optional_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = H5VL__attr_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__attr_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_optional * * Purpose: Performs an optional connector-specific operation on an attribute @@ -1656,10 +2570,11 @@ herr_t 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 */ + H5VL_attr_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -1668,13 +2583,24 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid 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 */ - /* (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"); + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'optional' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_optional() */ /*------------------------------------------------------------------------- @@ -1706,7 +2632,7 @@ H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_li /* 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") + 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) @@ -1778,6 +2704,35 @@ done: } /* end H5VL_attr_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__attr_close_api_op + * + * Purpose: Callback for common API wrapper to close an attribute + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__attr_close_api_op(void *_ctx) +{ + H5VL_attr_close_ctx_t *ctx = (H5VL_attr_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__attr_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__attr_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLattr_close * * Purpose: Closes an attribute @@ -1790,10 +2745,11 @@ done: herr_t H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_attr_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -1802,12 +2758,18 @@ H5VLattr_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) 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__attr_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close attribute") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__attr_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLattr_close() */ /*------------------------------------------------------------------------- @@ -1882,6 +2844,37 @@ done: } /* end H5VL_dataset_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_create_api_op + * + * Purpose: Callback for common API wrapper to create a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_create_api_op(void *_ctx) +{ + H5VL_dataset_create_ctx_t *ctx = (H5VL_dataset_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__dataset_create(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->lcpl_id, ctx->type_id, ctx->space_id, + ctx->dcpl_id, ctx->dapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_create * * Purpose: Creates a dataset @@ -1896,10 +2889,11 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect hid_t lcpl_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_dataset_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE11("*x", "*x*#i*siiiiiix", obj, loc_params, connector_id, name, lcpl_id, type_id, space_id, dcpl_id, dapl_id, dxpl_id, req); @@ -1909,13 +2903,29 @@ H5VLdataset_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connect if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__dataset_create(obj, loc_params, cls, name, lcpl_id, type_id, space_id, - dcpl_id, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create dataset") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.lcpl_id = lcpl_id; + ctx.type_id = type_id; + ctx.space_id = space_id; + ctx.dcpl_id = dcpl_id; + ctx.dapl_id = dapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; + +done: + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_create() */ /*------------------------------------------------------------------------- @@ -1986,6 +2996,36 @@ done: } /* end H5VL_dataset_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_open_api_op + * + * Purpose: Callback for common API wrapper to open a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_open_api_op(void *_ctx) +{ + H5VL_dataset_open_ctx_t *ctx = (H5VL_dataset_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__dataset_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->dapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_open * * Purpose: Opens a dataset @@ -1999,10 +3039,11 @@ void * H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t dapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_dataset_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, dapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2011,12 +3052,25 @@ H5VLdataset_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__dataset_open(obj, loc_params, cls, name, dapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open dataset") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.dapl_id = dapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_open() */ /*------------------------------------------------------------------------- @@ -2087,6 +3141,36 @@ done: } /* end H5VL_dataset_read() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_read_api_op + * + * Purpose: Callback for common API wrapper to read a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_read_api_op(void *_ctx) +{ + H5VL_dataset_read_ctx_t *ctx = (H5VL_dataset_read_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_read(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->mem_space_id, ctx->file_space_id, + ctx->dxpl_id, ctx->buf, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_read_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_read * * Purpose: Reads data from a dataset @@ -2100,10 +3184,11 @@ herr_t H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, void *buf, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_read_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE8("e", "*xiiiii*xx", obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req); @@ -2113,12 +3198,22 @@ H5VLdataset_read(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_spa 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__dataset_read(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to read dataset") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.mem_space_id = mem_space_id; + ctx.file_space_id = file_space_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_read_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_read() */ /*------------------------------------------------------------------------- @@ -2189,6 +3284,36 @@ done: } /* end H5VL_dataset_write() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_write_api_op + * + * Purpose: Callback for common API wrapper to write a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_write_api_op(void *_ctx) +{ + H5VL_dataset_write_ctx_t *ctx = (H5VL_dataset_write_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_write(ctx->obj, ctx->cls, ctx->mem_type_id, ctx->mem_space_id, ctx->file_space_id, + ctx->dxpl_id, ctx->buf, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_write_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_write * * Purpose: Writes data to a dataset @@ -2202,10 +3327,11 @@ herr_t H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_write_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE8("e", "*xiiiii*xx", obj, connector_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req); @@ -2215,12 +3341,22 @@ H5VLdataset_write(void *obj, hid_t connector_id, hid_t mem_type_id, hid_t mem_sp 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__dataset_write(obj, cls, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to write dataset") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.mem_type_id = mem_type_id; + ctx.mem_space_id = mem_space_id; + ctx.file_space_id = file_space_id; + ctx.buf = buf; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_write_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_write() */ /*------------------------------------------------------------------------- @@ -2289,6 +3425,35 @@ done: } /* end H5VL_dataset_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_get_api_op(void *_ctx) +{ + H5VL_dataset_get_ctx_t *ctx = (H5VL_dataset_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_get * * Purpose: Gets information about a dataset @@ -2302,10 +3467,11 @@ herr_t 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 */ + H5VL_dataset_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2314,12 +3480,19 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, 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") - /* Call the corresponding internal VOL routine */ - if (H5VL__dataset_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_get() */ /*------------------------------------------------------------------------- @@ -2346,7 +3519,7 @@ H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific /* Call the corresponding VOL callback */ if ((cls->dataset_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2378,7 +3551,7 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_args_t /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'specific' callback") done: /* Reset object wrapping info in API context */ @@ -2389,6 +3562,35 @@ done: } /* end H5VL_dataset_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_specific_api_op(void *_ctx) +{ + H5VL_dataset_specific_ctx_t *ctx = (H5VL_dataset_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_specific * * Purpose: Performs a connector-specific operation on a dataset @@ -2402,10 +3604,11 @@ herr_t 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 */ + H5VL_dataset_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2414,12 +3617,19 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t 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__dataset_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_specific() */ /*------------------------------------------------------------------------- @@ -2446,7 +3656,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t /* Call the corresponding VOL callback */ if ((cls->dataset_cls.optional)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -2477,7 +3687,7 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -2488,6 +3698,35 @@ done: } /* end H5VL_dataset_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_optional_api_op + * + * Purpose: Callback for common API wrapper to perform optional operation on a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_optional_api_op(void *_ctx) +{ + H5VL_dataset_optional_ctx_t *ctx = (H5VL_dataset_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_optional * * Purpose: Performs an optional connector-specific operation on a dataset @@ -2501,10 +3740,11 @@ herr_t 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 */ + H5VL_dataset_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2513,12 +3753,19 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, 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__dataset_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_optional() */ /*------------------------------------------------------------------------- @@ -2550,7 +3797,7 @@ H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app /* 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") + 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) @@ -2639,6 +3886,35 @@ done: } /* end H5VL_dataset_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__dataset_close_api_op + * + * Purpose: Callback for common API wrapper to close a dataset + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__dataset_close_api_op(void *_ctx) +{ + H5VL_dataset_close_ctx_t *ctx = (H5VL_dataset_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__dataset_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__dataset_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdataset_close * * Purpose: Closes a dataset @@ -2651,10 +3927,11 @@ done: herr_t H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_dataset_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2663,12 +3940,18 @@ H5VLdataset_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out 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__dataset_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close dataset") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__dataset_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdataset_close() */ /*------------------------------------------------------------------------- @@ -2741,6 +4024,37 @@ done: } /* end H5VL_datatype_commit() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_commit_api_op + * + * Purpose: Callback for common API wrapper to create an named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_commit_api_op(void *_ctx) +{ + H5VL_datatype_commit_ctx_t *ctx = (H5VL_datatype_commit_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = + H5VL__datatype_commit(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, ctx->type_id, + ctx->lcpl_id, ctx->tcpl_id, ctx->tapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to commit datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_commit_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_commit * * Purpose: Commits a datatype to the file @@ -2755,10 +4069,11 @@ H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec hid_t type_id, hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_datatype_commit_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE10("*x", "*x*#i*siiiiix", obj, loc_params, connector_id, name, type_id, lcpl_id, tcpl_id, tapl_id, dxpl_id, req); @@ -2768,13 +4083,28 @@ H5VLdatatype_commit(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, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__datatype_commit(obj, loc_params, cls, name, type_id, lcpl_id, tcpl_id, - tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to commit datatype") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.type_id = type_id; + ctx.lcpl_id = lcpl_id; + ctx.tcpl_id = tcpl_id; + ctx.tapl_id = tapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_commit_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_commit() */ /*------------------------------------------------------------------------- @@ -2845,6 +4175,36 @@ done: } /* end H5VL_datatype_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_open_api_op + * + * Purpose: Callback for common API wrapper to open a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_open_api_op(void *_ctx) +{ + H5VL_datatype_open_ctx_t *ctx = (H5VL_datatype_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__datatype_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->tapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_open * * Purpose: Opens a named datatype @@ -2858,10 +4218,11 @@ void * H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t tapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_datatype_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, tapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -2870,12 +4231,25 @@ H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__datatype_open(obj, loc_params, cls, name, tapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open datatype") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.tapl_id = tapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_open() */ /*------------------------------------------------------------------------- @@ -2944,6 +4318,35 @@ done: } /* end H5VL_datatype_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_get_api_op(void *_ctx) +{ + H5VL_datatype_get_ctx_t *ctx = (H5VL_datatype_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_get * * Purpose: Gets information about the datatype @@ -2957,10 +4360,11 @@ herr_t 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 */ + H5VL_datatype_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -2969,12 +4373,19 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, 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__datatype_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_get() */ /*------------------------------------------------------------------------- @@ -3001,7 +4412,7 @@ H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specif /* Call the corresponding VOL callback */ if ((cls->datatype_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3033,7 +4444,7 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'specific' callback") done: /* Reset object wrapping info in API context */ @@ -3044,6 +4455,35 @@ done: } /* end H5VL_datatype_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_specific_api_op + * + * Purpose: Callback for common API wrapper to perform a specific operation on a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_specific_api_op(void *_ctx) +{ + H5VL_datatype_specific_ctx_t *ctx = (H5VL_datatype_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_specific * * Purpose: Performs a connector-specific operation on a datatype @@ -3057,10 +4497,11 @@ herr_t 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 */ + H5VL_datatype_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3069,12 +4510,19 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args 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__datatype_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_specific() */ /*------------------------------------------------------------------------- @@ -3101,7 +4549,7 @@ H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t /* Call the corresponding VOL callback */ if ((cls->datatype_cls.optional)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3132,7 +4580,7 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -3176,7 +4624,7 @@ H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hi /* 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -3187,6 +4635,35 @@ done: } /* end H5VL_datatype_optional_op() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_optional_api_op + * + * Purpose: Callback for common API wrapper to perform an optional operation on a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_optional_api_op(void *_ctx) +{ + H5VL_datatype_optional_ctx_t *ctx = (H5VL_datatype_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_optional * * Purpose: Performs an optional connector-specific operation on a datatype @@ -3200,10 +4677,11 @@ herr_t 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 */ + H5VL_datatype_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3212,12 +4690,19 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, 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__datatype_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_optional() */ /*------------------------------------------------------------------------- @@ -3332,6 +4817,35 @@ done: } /* end H5VL_datatype_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__datatype_close_api_op + * + * Purpose: Callback for common API wrapper to close a named datatype + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__datatype_close_api_op(void *_ctx) +{ + H5VL_datatype_close_ctx_t *ctx = (H5VL_datatype_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__datatype_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__datatype_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLdatatype_close * * Purpose: Closes a datatype @@ -3344,10 +4858,11 @@ done: herr_t H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_datatype_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -3356,12 +4871,18 @@ H5VLdatatype_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*ou 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__datatype_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close datatype") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__datatype_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLdatatype_close() */ /*------------------------------------------------------------------------- @@ -3405,27 +4926,69 @@ done: * Note: Does not have a 'static' version of the routine, since there's * no objects in the container before this operation completes. * - * Return: Success: Pointer to new file - * Failure: NULL + * Return: Success: A file ID + * Failure: H5I_INVALID_HID * *------------------------------------------------------------------------- */ -void * -H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fcpl_id, - hid_t fapl_id, hid_t dxpl_id, void **req) +hid_t +H5VL_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req) { - H5VL_class_t *cls; /* VOL Class structure for callback info */ - void * ret_value = NULL; /* Return value */ + H5P_genplist_t * fapl_plist; /* Property list pointer */ + H5VL_class_t * cls; /* VOL class structure for callback info */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + void * file = NULL; /* New file created */ + hid_t ret_value = H5I_INVALID_HID; /* Return value */ - FUNC_ENTER_NOAPI(NULL) + FUNC_ENTER_NOAPI(FAIL) + + /* Get the VOL info from the fapl */ + if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a file access property list") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't get VOL connector info") + + /* Stash a copy of the connector property */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, H5I_INVALID_HID, "can't set VOL connector info in API context") /* Get the connector's class */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "file create failed") + if (NULL == (file = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "file create failed") + + /* Create a temporary VOL object for the file struct */ + if (NULL == + (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file, connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, H5I_INVALID_HID, "can't create VOL object") + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(file, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, H5I_INVALID_HID, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(file, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, H5I_INVALID_HID, "file optional failed") + } /* end if */ + + /* Register ID for VOL object, for future API calls */ + if ((ret_value = H5I_register(H5I_FILE, vol_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file ID") done: FUNC_LEAVE_NOAPI(ret_value) @@ -3445,19 +5008,50 @@ void * H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req /*out*/) { - H5P_genplist_t * plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5VL_class_t * cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5P_genplist_t * fapl_plist = NULL; /* FAPL property list pointer */ + H5P_genplist_t * dxpl_plist = NULL; /* DXPL property list pointer */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t * cls; /* VOL connector's class struct */ + hbool_t new_api_ctx = FALSE; /* Whether to start a new API context */ + hbool_t api_pushed = FALSE; /* Indicate that a new API context was pushed */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE6("*x", "*sIuiiix", name, flags, fcpl_id, fapl_id, dxpl_id, req); /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + if (NULL == (fapl_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Check for non-default DXPL */ + if (!(H5P_DEFAULT == dxpl_id || H5P_DATASET_XFER_DEFAULT == dxpl_id)) { + /* Check for 'new API context' flag */ + if (NULL == (dxpl_plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a dataset transfer property list") + if (H5P_get(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to get value") + + /* Start a new API context, if requested */ + if (new_api_ctx) { + hbool_t reset_api_ctx = FALSE; /* Flag to reset the 'new API context' */ + + /* Push the API context */ + if (H5CX_push() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set API context") + api_pushed = TRUE; + + /* Reset 'new API context' flag for next layer down */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &reset_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + /* Stash a copy of the connector property */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + } /* end if */ + } /* end if */ /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) @@ -3467,8 +5061,53 @@ H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, if (NULL == (ret_value = H5VL__file_create(cls, name, flags, fcpl_id, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create file") + /* Attempt 'post open' callback, for new API contexts */ + if (new_api_ctx) { + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(ret_value, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, + &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Create a temporary VOL object for the file struct */ + if (NULL == (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, ret_value, + connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't create VOL object") + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(ret_value, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "file optional failed") + } /* end if */ + } /* end if */ + done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* Destroy temporary VOL file object */ + if (vol_obj && H5VL_free_object(vol_obj) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, NULL, "unable to free VOL object") + + /* Pop the API context, if it was pushed */ + if (api_pushed) { + hbool_t undo_api_ctx = TRUE; /* Flag to reset the 'new API context' */ + + /* Undo change to 'new API context' flag */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &undo_api_ctx) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + (void)H5CX_pop(FALSE); + } /* end if */ + + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_create() */ /*------------------------------------------------------------------------- @@ -3607,26 +5246,43 @@ done: * Note: Does not have a 'static' version of the routine, since there's * no objects in the container before this operation completes. * - * Return: Success: Pointer to file. + * Return: Success: Pointer to file VOL object * Failure: NULL * *------------------------------------------------------------------------- */ -void * -H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, hid_t fapl_id, - hid_t dxpl_id, void **req) +H5VL_object_t * +H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req, + hid_t *ret_id /*out*/) { - H5VL_class_t *cls; /* VOL Class structure for callback info */ - void * ret_value = NULL; /* Return value */ + H5P_genplist_t * fapl_plist; /* Property list pointer */ + H5VL_class_t * cls; /* VOL class structure for callback info */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + void * file = NULL; /* File pointer */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + H5VL_object_t * ret_value = NULL; /* Return value */ FUNC_ENTER_NOAPI(NULL) + /* Get the VOL info from the fapl */ + if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a file access property list") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't get VOL connector info") + + /* Stash a copy of the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + /* Get the connector's class */ - if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop->connector_id, H5I_VOL))) - HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID") /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) { + if (NULL == (file = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) { hbool_t is_default_conn = TRUE; /* Opening the file failed - Determine whether we should search @@ -3634,13 +5290,13 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned * to attempt to open the file with. This only occurs if the default * VOL connector was used for the initial file open attempt. */ - H5VL__is_default_conn(fapl_id, connector_prop->connector_id, &is_default_conn); + H5VL__is_default_conn(fapl_id, connector_prop.connector_id, &is_default_conn); 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.connector_prop = &connector_prop; find_connector_ud.filename = name; find_connector_ud.cls = NULL; find_connector_ud.fapl_id = fapl_id; @@ -3659,8 +5315,14 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned */ 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))) + /* Update the "top-level" connector property, before any pass-through + * connectors modify or unwrap it. + */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + + if (NULL == (file = 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) @@ -3672,6 +5334,46 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed") } /* end if */ + /* Create a VOL object for the file struct */ + if (NULL == + (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, file, connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't create VOL object") + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(file, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = + (ret_id != NULL); /* Set the 'id_exists' flag to TRUE when returning an ID */ + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(file, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "file optional failed") + } /* end if */ + + /* Check for registering ID for file */ + if (ret_id) { + hid_t file_id; /* File ID for file pointer */ + + /* Register ID for VOL object, for future API calls */ + if ((file_id = H5I_register(H5I_FILE, vol_obj, TRUE)) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, NULL, "unable to register file ID") + + /* Set file ID to return */ + *ret_id = file_id; + } /* end if */ + + /* Set return value */ + ret_value = vol_obj; + done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5VL_file_open() */ @@ -3689,20 +5391,51 @@ done: void * H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req /*out*/) { - H5P_genplist_t * plist; /* Property list pointer */ - H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ - H5VL_class_t * cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5P_genplist_t * fapl_plist = NULL; /* FAPL property list pointer */ + H5P_genplist_t * dxpl_plist = NULL; /* DXPL property list pointer */ + H5VL_object_t * vol_obj = NULL; /* Temporary VOL object for file */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t * cls; /* VOL connector's class struct */ + hbool_t new_api_ctx = FALSE; /* Whether to start a new API context */ + hbool_t api_pushed = FALSE; /* Indicate that a new API context was pushed */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE5("*x", "*sIuiix", name, flags, fapl_id, dxpl_id, req); /* Get the VOL info from the fapl */ - if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id))) + if (NULL == (fapl_plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file access property list") - if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get VOL connector info") + /* Check for non-default DXPL */ + if (!(H5P_DEFAULT == dxpl_id || H5P_DATASET_XFER_DEFAULT == dxpl_id)) { + /* Check for 'new API context' flag */ + if (NULL == (dxpl_plist = H5P_object_verify(dxpl_id, H5P_DATASET_XFER))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a dataset transfer property list") + if (H5P_get(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &new_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "unable to get value") + + /* Start a new API context, if requested */ + if (new_api_ctx) { + hbool_t reset_api_ctx = FALSE; /* Flag to reset the 'new API context' */ + + /* Push the API context */ + if (H5CX_push() < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set API context") + api_pushed = TRUE; + + /* Reset 'new API context' flag for next layer down */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &reset_api_ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + /* Stash a copy of the connector property */ + if (H5CX_set_vol_connector_prop(&connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTSET, NULL, "can't set VOL connector info in API context") + } /* end if */ + } /* end if */ + /* Get class pointer */ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") @@ -3711,8 +5444,53 @@ H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, vo if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open file") + /* Attempt 'post open' callback, for new API contexts */ + if (new_api_ctx) { + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(ret_value, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, + &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, NULL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Create a temporary VOL object for the file struct */ + if (NULL == (vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, ret_value, + connector_prop.connector_id, FALSE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "can't create VOL object") + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(ret_value, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "file optional failed") + } /* end if */ + } /* end if */ + done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* Destroy temporary VOL file object */ + if (vol_obj && H5VL_free_object(vol_obj) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, NULL, "unable to free VOL object") + + /* Pop the API context, if it was pushed */ + if (api_pushed) { + hbool_t undo_api_ctx = TRUE; /* Flag to reset the 'new API context' */ + + /* Undo change to 'new API context' flag */ + if (H5P_set(dxpl_plist, H5D_XFER_PLUGIN_NEW_API_CTX_NAME, &undo_api_ctx) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTSET, NULL, "unable to set value") + + (void)H5CX_pop(FALSE); + } /* end if */ + + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_open() */ /*------------------------------------------------------------------------- @@ -3780,6 +5558,35 @@ done: } /* end H5VL_file_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_get_api_op(void *_ctx) +{ + H5VL_file_get_ctx_t *ctx = (H5VL_file_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_get * * Purpose: Gets information about the file @@ -3792,10 +5599,11 @@ done: herr_t 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 */ + H5VL_file_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -3804,12 +5612,19 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dx 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_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_get() */ /*------------------------------------------------------------------------- @@ -3856,6 +5671,7 @@ herr_t 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 */ + H5VL_object_t * reopen_vol_obj = NULL; /* Temporary VOL object for file */ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ herr_t ret_value = SUCCEED; /* Return value */ @@ -3903,7 +5719,46 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args 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") + /* Special treatment of file re-open operation */ + if (args->op_type == H5VL_FILE_REOPEN) { + void * reopen_file; /* Pointer to re-opened file */ + uint64_t supported; /* Whether 'post open' operation is supported by VOL connector */ + + /* Get pointer to re-opened file */ + reopen_file = *args->args.reopen.file; + HDassert(reopen_file); + + /* Check for 'post open' callback */ + supported = 0; + if (H5VL__introspect_opt_query(reopen_file, cls, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, + &supported) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") + if (supported & H5VL_OPT_QUERY_SUPPORTED) { + H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */ + H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */ + + /* Create a temporary VOL object for the file struct */ + if (NULL == (reopen_vol_obj = H5VL_create_object_using_vol_id(H5I_FILE, reopen_file, + vol_obj->connector->id, TRUE))) + HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "can't create VOL object") + + /* Set up VOL callback arguments */ + file_opt_args.post_open.vol_obj = reopen_vol_obj; + file_opt_args.post_open.id_exists = TRUE; + vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN; + vol_cb_args.args = &file_opt_args; + + /* Make the 'post open' callback */ + if (H5VL__file_optional(reopen_file, cls, &vol_cb_args, dxpl_id, req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed") + } /* end if */ + } /* end if */ + done: + /* Destroy temporary VOL file object */ + if (reopen_vol_obj && H5VL_free_object(reopen_vol_obj) < 0) + HDONE_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free VOL object") + /* 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") @@ -3912,6 +5767,35 @@ done: } /* end H5VL_file_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_specific_api_op + * + * Purpose: Callback for common API wrapper to perform 'specific' operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_specific_api_op(void *_ctx) +{ + H5VL_file_specific_ctx_t *ctx = (H5VL_file_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_specific * * Purpose: Performs a connector-specific operation on a file @@ -3927,22 +5811,30 @@ herr_t 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 */ + H5VL_file_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) 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, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_specific() */ /*------------------------------------------------------------------------- @@ -4010,6 +5902,35 @@ done: } /* end H5VL_file_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_optional_api_op + * + * Purpose: Callback for common API wrapper to perform 'optional' operation on a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_optional_api_op(void *_ctx) +{ + H5VL_file_optional_ctx_t *ctx = (H5VL_file_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_optional * * Purpose: Performs an optional connector-specific operation on a file @@ -4023,10 +5944,11 @@ herr_t 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 */ + H5VL_file_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4035,12 +5957,19 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid 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_optional(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_optional() */ /*------------------------------------------------------------------------- @@ -4072,7 +6001,7 @@ H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_li /* 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") + 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) @@ -4155,6 +6084,35 @@ done: } /* end H5VL_file_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__file_close_api_op + * + * Purpose: Callback for common API wrapper to close a file + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__file_close_api_op(void *_ctx) +{ + H5VL_file_close_ctx_t *ctx = (H5VL_file_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__file_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__file_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLfile_close * * Purpose: Closes a file @@ -4167,10 +6125,11 @@ done: herr_t H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_file_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4179,12 +6138,18 @@ H5VLfile_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) 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_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEFILE, FAIL, "unable to close file") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__file_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLfile_close() */ /*------------------------------------------------------------------------- @@ -4256,6 +6221,37 @@ done: } /* end H5VL_group_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_create_api_op + * + * Purpose: Callback for common API wrapper to create a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_create_api_op(void *_ctx) +{ + H5VL_group_create_ctx_t *ctx = (H5VL_group_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == + (ctx->ret_value = H5VL__group_create(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, ctx->lcpl_id, + ctx->gcpl_id, ctx->gapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_create * * Purpose: Creates a group @@ -4269,10 +6265,11 @@ void * H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_group_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE9("*x", "*x*#i*siiiix", obj, loc_params, connector_id, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req); @@ -4282,13 +6279,27 @@ H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == - (ret_value = H5VL__group_create(obj, loc_params, cls, name, lcpl_id, gcpl_id, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "unable to create group") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.lcpl_id = lcpl_id; + ctx.gcpl_id = gcpl_id; + ctx.gapl_id = gapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_create() */ /*------------------------------------------------------------------------- @@ -4359,6 +6370,36 @@ done: } /* end H5VL_group_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_open_api_op + * + * Purpose: Callback for common API wrapper to open a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_open_api_op(void *_ctx) +{ + H5VL_group_open_ctx_t *ctx = (H5VL_group_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__group_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->name, + ctx->gapl_id, ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_open * * Purpose: Opens a group @@ -4372,10 +6413,11 @@ void * H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, const char *name, hid_t gapl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_group_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(NULL) H5TRACE7("*x", "*x*#i*siix", obj, loc_params, connector_id, name, gapl_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4384,12 +6426,25 @@ H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__group_open(obj, loc_params, cls, name, gapl_id, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, NULL, "unable to open group") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.name = name; + ctx.gapl_id = gapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_open() */ /*------------------------------------------------------------------------- @@ -4457,6 +6512,35 @@ done: } /* end H5VL_group_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_get_api_op(void *_ctx) +{ + H5VL_group_get_ctx_t *ctx = (H5VL_group_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__group_get(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_get * * Purpose: Gets information about the group @@ -4469,10 +6553,11 @@ done: herr_t 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 */ + H5VL_group_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4481,12 +6566,19 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t 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__group_get(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_get() */ /*------------------------------------------------------------------------- @@ -4513,7 +6605,7 @@ H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_arg /* Call the corresponding VOL callback */ if ((cls->group_cls.specific)(obj, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -4544,7 +6636,7 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *ar /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group 'specific' callback") done: /* Reset object wrapping info in API context */ @@ -4555,6 +6647,35 @@ done: } /* end H5VL_group_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_specific_api_op(void *_ctx) +{ + H5VL_group_specific_ctx_t *ctx = (H5VL_group_specific_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__group_specific(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group 'specific' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_specific * * Purpose: Performs a connector-specific operation on a group @@ -4568,10 +6689,11 @@ herr_t 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 */ + H5VL_group_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4580,12 +6702,19 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *ar 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__group_specific(obj, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_specific() */ /*------------------------------------------------------------------------- @@ -4613,7 +6742,7 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *a /* Call the corresponding VOL 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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group 'optional' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -4645,7 +6774,7 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hi /* Call the corresponding internal VOL routine */ /* (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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -4656,6 +6785,33 @@ done: } /* end H5VL_group_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_optional_api_op + * + * Purpose: Callback for common API wrapper to perform optional operation on a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_optional_api_op(void *_ctx) +{ + H5VL_group_optional_ctx_t *ctx = (H5VL_group_optional_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = H5VL__group_optional(ctx->obj, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__group_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_optional * * Purpose: Performs an optional connector-specific operation on a group @@ -4669,10 +6825,11 @@ herr_t 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 */ + H5VL_group_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -4681,13 +6838,24 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, 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") - /* Call the corresponding internal VOL routine */ - /* (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"); + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group 'optional' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_optional() */ /*------------------------------------------------------------------------- @@ -4719,7 +6887,7 @@ H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_l /* 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") + 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) @@ -4802,6 +6970,35 @@ done: } /* end H5VL_group_close() */ /*------------------------------------------------------------------------- + * Function: H5VL__group_close_api_op + * + * Purpose: Callback for common API wrapper to close a group + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__group_close_api_op(void *_ctx) +{ + H5VL_group_close_ctx_t *ctx = (H5VL_group_close_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__group_close(ctx->obj, ctx->cls, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__group_close_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLgroup_close * * Purpose: Closes a group @@ -4814,10 +7011,11 @@ done: herr_t H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_group_close_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiix", obj, connector_id, dxpl_id, req); /* Check args and get class pointer */ @@ -4826,12 +7024,18 @@ H5VLgroup_close(void *obj, hid_t connector_id, hid_t dxpl_id, void **req /*out*/ 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__group_close(obj, cls, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "unable to close group") + /* Set up context */ + ctx.obj = obj; + ctx.cls = cls; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__group_close_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLgroup_close() */ /*------------------------------------------------------------------------- @@ -4914,6 +7118,36 @@ done: } /* end H5VL_link_create() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_create_api_op + * + * Purpose: Callback for common API wrapper to create a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_create_api_op(void *_ctx) +{ + H5VL_link_create_ctx_t *ctx = (H5VL_link_create_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_create(ctx->args, ctx->obj, ctx->loc_params, ctx->cls, ctx->lcpl_id, ctx->lapl_id, + ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_create_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_create * * Purpose: Creates a link @@ -4929,22 +7163,33 @@ herr_t 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 */ + H5VL_link_create_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) 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(args, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link") + /* Set up context */ + ctx.args = args; + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.lcpl_id = lcpl_id; + ctx.lapl_id = lapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_create_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_create() */ /*------------------------------------------------------------------------- @@ -4958,9 +7203,9 @@ done: *------------------------------------------------------------------------- */ 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) +H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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 */ @@ -4971,7 +7216,8 @@ H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_o HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link copy' method") /* Call the corresponding VOL callback */ - if ((cls->link_cls.copy)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) + if ((cls->link_cls.copy)(src_obj, src_loc_params, dst_obj, dst_loc_params, lcpl_id, lapl_id, dxpl_id, + req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") done: @@ -4989,8 +7235,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, - const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, +H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { const H5VL_object_t *vol_obj; /* VOL object for object with data */ @@ -5006,8 +7252,8 @@ H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if (H5VL__link_copy(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, - vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if (H5VL__link_copy(src_vol_obj->data, src_loc_params, (dst_vol_obj ? dst_vol_obj->data : NULL), + dst_loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "link copy failed") done: @@ -5019,6 +7265,36 @@ done: } /* end H5VL_link_copy() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_copy_api_op + * + * Purpose: Callback for common API wrapper to copy a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_copy_api_op(void *_ctx) +{ + H5VL_link_copy_ctx_t *ctx = (H5VL_link_copy_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_copy(ctx->src_obj, ctx->src_loc_params, ctx->dst_obj, ctx->dst_loc_params, ctx->cls, + ctx->lcpl_id, ctx->lapl_id, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_copy_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_copy * * Purpose: Copies a link to a new location @@ -5031,27 +7307,39 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, - const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, +H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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 */ + H5VL_link_copy_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, - dxpl_id, req); + FUNC_ENTER_API_WRAPPER(FAIL) + H5TRACE9("e", "*x*#*x*#iiiix", src_obj, src_loc_params, dst_obj, dst_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_copy(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + /* Set up context */ + ctx.src_obj = src_obj; + ctx.src_loc_params = src_loc_params; + ctx.dst_obj = dst_obj; + ctx.dst_loc_params = dst_loc_params; + ctx.cls = cls; + ctx.lcpl_id = lcpl_id; + ctx.lapl_id = lapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_copy_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_copy() */ /*------------------------------------------------------------------------- @@ -5065,9 +7353,9 @@ done: *------------------------------------------------------------------------- */ static herr_t -H5VL__link_move(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) +H5VL__link_move(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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 */ @@ -5078,7 +7366,8 @@ H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_o HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link move' method") /* Call the corresponding VOL callback */ - if ((cls->link_cls.move)(src_obj, loc_params1, dst_obj, loc_params2, lcpl_id, lapl_id, dxpl_id, req) < 0) + if ((cls->link_cls.move)(src_obj, src_loc_params, dst_obj, dst_loc_params, lcpl_id, lapl_id, dxpl_id, + req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") done: @@ -5096,8 +7385,8 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, - const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, +H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req) { const H5VL_object_t *vol_obj; /* VOL object for object with data */ @@ -5113,8 +7402,8 @@ H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_pa vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if (H5VL__link_move(src_vol_obj->data, loc_params1, (dst_vol_obj ? dst_vol_obj->data : NULL), loc_params2, - vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) + if (H5VL__link_move(src_vol_obj->data, src_loc_params, (dst_vol_obj ? dst_vol_obj->data : NULL), + dst_loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id, req) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "link move failed") done: @@ -5126,6 +7415,36 @@ done: } /* end H5VL_link_move() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_move_api_op + * + * Purpose: Callback for common API wrapper to move a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_move_api_op(void *_ctx) +{ + H5VL_link_move_ctx_t *ctx = (H5VL_link_move_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_move(ctx->src_obj, ctx->src_loc_params, ctx->dst_obj, ctx->dst_loc_params, ctx->cls, + ctx->lcpl_id, ctx->lapl_id, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_move_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_move * * Purpose: Moves a link to another location @@ -5138,27 +7457,39 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj, - const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, +H5VLlink_move(void *src_obj, const H5VL_loc_params_t *src_loc_params, void *dst_obj, + const H5VL_loc_params_t *dst_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 */ + H5VL_link_move_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT - H5TRACE9("e", "*x*#*x*#iiiix", src_obj, loc_params1, dst_obj, loc_params2, connector_id, lcpl_id, lapl_id, - dxpl_id, req); + FUNC_ENTER_API_WRAPPER(FAIL) + H5TRACE9("e", "*x*#*x*#iiiix", src_obj, src_loc_params, dst_obj, dst_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_move(src_obj, loc_params1, dst_obj, loc_params2, cls, lcpl_id, lapl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTMOVE, FAIL, "unable to move object") + /* Set up context */ + ctx.src_obj = src_obj; + ctx.src_loc_params = src_loc_params; + ctx.dst_obj = dst_obj; + ctx.dst_loc_params = dst_loc_params; + ctx.cls = cls; + ctx.lcpl_id = lcpl_id; + ctx.lapl_id = lapl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_move_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_move() */ /*------------------------------------------------------------------------- @@ -5228,6 +7559,35 @@ done: } /* end H5VL_link_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_get_api_op(void *_ctx) +{ + H5VL_link_get_ctx_t *ctx = (H5VL_link_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_get(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_get * * Purpose: Gets information about a link @@ -5241,10 +7601,11 @@ herr_t 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 */ + H5VL_link_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5253,12 +7614,20 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, 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_get(obj, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_get() */ /*------------------------------------------------------------------------- @@ -5286,7 +7655,7 @@ H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Call the corresponding VOL 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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -5320,7 +7689,7 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* (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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: /* Reset object wrapping info in API context */ @@ -5331,6 +7700,34 @@ done: } /* end H5VL_link_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_specific_api_op(void *_ctx) +{ + H5VL_link_specific_ctx_t *ctx = (H5VL_link_specific_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = + H5VL__link_specific(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__link_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_specific * * Purpose: Performs a connector-specific operation on a link @@ -5344,10 +7741,11 @@ herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, 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 */ + H5VL_link_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5356,13 +7754,25 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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 */ - /* (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"); + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_specific() */ /*------------------------------------------------------------------------- @@ -5389,7 +7799,7 @@ H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c /* Call the corresponding VOL callback */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5421,7 +7831,7 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -5432,6 +7842,35 @@ done: } /* end H5VL_link_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__link_optional_api_op + * + * Purpose: Callback for common API wrapper to issue optional operations on a link + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__link_optional_api_op(void *_ctx) +{ + H5VL_link_optional_ctx_t *ctx = (H5VL_link_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__link_optional(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__link_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLlink_optional * * Purpose: Performs an optional connector-specific operation on a link @@ -5445,10 +7884,11 @@ herr_t 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 */ + H5VL_link_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5457,12 +7897,20 @@ H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto 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_optional(obj, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__link_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLlink_optional() */ /*------------------------------------------------------------------------- @@ -5509,7 +7957,7 @@ H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_li /* 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") + 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) @@ -5537,7 +7985,7 @@ done: *------------------------------------------------------------------------- */ static void * -H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls, +H5VL__object_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { void *ret_value = NULL; /* Return value */ @@ -5549,7 +7997,7 @@ H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, NULL, "VOL connector has no 'object open' method") /* Call the corresponding VOL callback */ - if (NULL == (ret_value = (cls->object_cls.open)(obj, params, opened_type, dxpl_id, req))) + if (NULL == (ret_value = (cls->object_cls.open)(obj, loc_params, opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") done: @@ -5567,7 +8015,7 @@ done: *------------------------------------------------------------------------- */ void * -H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, H5I_type_t *opened_type, +H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req) { hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */ @@ -5581,8 +8029,8 @@ H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, vol_wrapper_set = TRUE; /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__object_open(vol_obj->data, params, vol_obj->connector->cls, opened_type, - dxpl_id, req))) + if (NULL == (ret_value = H5VL__object_open(vol_obj->data, loc_params, vol_obj->connector->cls, + opened_type, dxpl_id, req))) HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "object open failed") done: @@ -5594,6 +8042,36 @@ done: } /* end H5VL_object_open() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_open_api_op + * + * Purpose: Callback for common API wrapper to open an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_open_api_op(void *_ctx) +{ + H5VL_object_open_ctx_t *ctx = (H5VL_object_open_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (NULL == (ctx->ret_value = H5VL__object_open(ctx->obj, ctx->loc_params, ctx->cls, ctx->opened_type, + ctx->dxpl_id, ctx->req))) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, FAIL, "unable to open object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_open_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_open * * Purpose: Opens an object @@ -5604,14 +8082,15 @@ done: *------------------------------------------------------------------------- */ void * -H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, H5I_type_t *opened_type, +H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5I_type_t *opened_type, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - void * ret_value = NULL; /* Return value */ + H5VL_object_open_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + void * ret_value = NULL; /* Return value */ - FUNC_ENTER_API_NOINIT - H5TRACE6("*x", "*x*#i*Itix", obj, params, connector_id, opened_type, dxpl_id, req); + FUNC_ENTER_API_WRAPPER(NULL) + H5TRACE6("*x", "*x*#i*Itix", obj, loc_params, connector_id, opened_type, dxpl_id, req); /* Check args and get class pointer */ if (NULL == obj) @@ -5619,12 +8098,24 @@ H5VLobject_open(void *obj, const H5VL_loc_params_t *params, hid_t connector_id, if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a VOL connector ID") - /* Call the corresponding internal VOL routine */ - if (NULL == (ret_value = H5VL__object_open(obj, params, cls, opened_type, dxpl_id, req))) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "unable to open object") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.opened_type = opened_type; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = NULL; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_open_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, NULL, "unable to execute common wrapper operation") + + /* Set return value */ + ret_value = ctx.ret_value; done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_open() */ /*------------------------------------------------------------------------- @@ -5703,6 +8194,36 @@ done: } /* end H5VL_object_copy() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_copy_api_op + * + * Purpose: Callback for common API wrapper to copy a object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_copy_api_op(void *_ctx) +{ + H5VL_object_copy_ctx_t *ctx = (H5VL_object_copy_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__object_copy(ctx->src_obj, ctx->src_loc_params, ctx->src_name, ctx->dst_obj, ctx->dst_loc_params, + ctx->dst_name, ctx->cls, ctx->ocpypl_id, ctx->lcpl_id, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_copy_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_copy * * Purpose: Copies an object to another location @@ -5717,10 +8238,11 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req /*out*/) { - H5VL_class_t *cls; /* VOL connector's class struct */ - herr_t ret_value = SUCCEED; /* Return value */ + H5VL_object_copy_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE11("e", "*x*#*s*x*#*siiiix", src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, connector_id, ocpypl_id, lcpl_id, dxpl_id, req); @@ -5730,13 +8252,25 @@ H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const ch 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__object_copy(src_obj, src_loc_params, src_name, dst_obj, dst_loc_params, dst_name, cls, - ocpypl_id, lcpl_id, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTCOPY, FAIL, "unable to copy object") - -done: - FUNC_LEAVE_API_NOINIT(ret_value) + /* Set up context */ + ctx.src_obj = src_obj; + ctx.src_loc_params = src_loc_params; + ctx.src_name = src_name; + ctx.dst_obj = dst_obj; + ctx.dst_loc_params = dst_loc_params; + ctx.dst_name = dst_name; + ctx.cls = cls; + ctx.ocpypl_id = ocpypl_id; + ctx.lcpl_id = lcpl_id; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_copy_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + +done: + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_copy() */ /*------------------------------------------------------------------------- @@ -5806,6 +8340,35 @@ done: } /* end H5VL_object_get() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_get_api_op + * + * Purpose: Callback for common API wrapper to get information about a object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_get_api_op(void *_ctx) +{ + H5VL_object_get_ctx_t *ctx = (H5VL_object_get_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__object_get(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object 'get' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_get_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_get * * Purpose: Gets information about an object @@ -5819,10 +8382,11 @@ herr_t 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 */ + H5VL_object_get_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5831,12 +8395,20 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i 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__object_get(obj, loc_params, cls, args, dxpl_id, req) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_get_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_get() */ /*------------------------------------------------------------------------- @@ -5909,6 +8481,34 @@ done: } /* end H5VL_object_specific() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_specific_api_op + * + * Purpose: Callback for common API wrapper to issue specific operations on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_specific_api_op(void *_ctx) +{ + H5VL_object_specific_ctx_t *ctx = (H5VL_object_specific_ctx_t *)_ctx; /* Get pointer to context */ + + FUNC_ENTER_STATIC_NOERR + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + /* (Must capture return value from callback, for iterators) */ + ctx->ret_value = + H5VL__object_specific(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req); + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5VL__object_specific_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_specific * * Purpose: Performs a connector-specific operation on an object @@ -5922,10 +8522,11 @@ herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, 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 */ + H5VL_object_specific_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -5934,13 +8535,25 @@ 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") - /* Bypass the H5VLint layer, calling the VOL callback directly */ - /* (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"); + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + ctx.ret_value = -1; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_specific_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") + + /* Must return value from callback, for iterators */ + if ((ret_value = ctx.ret_value) < 0) + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link 'specific' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_specific() */ /*------------------------------------------------------------------------- @@ -5967,7 +8580,7 @@ H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL /* Call the corresponding VOL callback */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -5999,7 +8612,7 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_ /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object 'optional' callback") done: /* Reset object wrapping info in API context */ @@ -6010,6 +8623,35 @@ done: } /* end H5VL_object_optional() */ /*------------------------------------------------------------------------- + * Function: H5VL__object_optional_api_op + * + * Purpose: Callback for common API wrapper to issue optional operations on an object + * + * Return: Success: Non-negative + * Failure: Negative + * + *------------------------------------------------------------------------- + */ +static herr_t +H5VL__object_optional_api_op(void *_ctx) +{ + H5VL_object_optional_ctx_t *ctx = (H5VL_object_optional_ctx_t *)_ctx; /* Get pointer to context */ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_STATIC + + /* Sanity check */ + HDassert(ctx); + + /* Call the corresponding internal VOL routine */ + if (H5VL__object_optional(ctx->obj, ctx->loc_params, ctx->cls, ctx->args, ctx->dxpl_id, ctx->req) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object 'optional' callback") + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL__object_optional_api_op() */ + +/*------------------------------------------------------------------------- * Function: H5VLobject_optional * * Purpose: Performs an optional connector-specific operation on an object @@ -6023,10 +8665,11 @@ herr_t 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 */ + H5VL_object_optional_ctx_t ctx; /* Context for common API wrapper call */ + H5VL_class_t * cls; /* VOL connector's class struct */ + herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -6035,12 +8678,20 @@ H5VLobject_optional(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") - /* Call the corresponding internal VOL routine */ - 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") + /* Set up context */ + ctx.obj = obj; + ctx.loc_params = loc_params; + ctx.cls = cls; + ctx.args = args; + ctx.dxpl_id = dxpl_id; + ctx.req = req; + + /* Invoke common wrapper routine */ + if (H5VL__common_api_op(dxpl_id, H5VL__object_optional_api_op, &ctx) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute common wrapper operation") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLobject_optional() */ /*------------------------------------------------------------------------- @@ -6088,7 +8739,7 @@ H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_ /* 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") + 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) @@ -6197,7 +8848,7 @@ H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t l H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiVLx", obj, connector_id, lvl, conn_cls); /* Check args */ @@ -6215,7 +8866,7 @@ H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t l HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector class") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLintrospect_get_conn_cls() */ /*------------------------------------------------------------------------- @@ -6269,7 +8920,7 @@ H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xix", info, connector_id, cap_flags); /* Check args */ @@ -6285,7 +8936,7 @@ H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLintrospect_get_cap_flags() */ /*------------------------------------------------------------------------- @@ -6373,7 +9024,7 @@ H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xiVSIsx", obj, connector_id, subcls, opt_type, flags); /* Get class pointer */ @@ -6385,7 +9036,7 @@ H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query optional operation support") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLintrospect_opt_query() */ /*------------------------------------------------------------------------- @@ -6466,7 +9117,7 @@ H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5VL_request_s H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiULx", req, connector_id, timeout, status); /* Get class pointer */ @@ -6478,7 +9129,7 @@ H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout, H5VL_request_s HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to wait on request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_wait() */ /*------------------------------------------------------------------------- @@ -6561,7 +9212,7 @@ H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xiVN*x", req, connector_id, cb, ctx); /* Get class pointer */ @@ -6573,7 +9224,7 @@ H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to register notify callback for request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_notify() */ /*------------------------------------------------------------------------- @@ -6653,7 +9304,7 @@ H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xix", req, connector_id, status); /* Get class pointer */ @@ -6665,7 +9316,7 @@ H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to cancel request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_cancel() */ /*------------------------------------------------------------------------- @@ -6696,7 +9347,7 @@ H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific /* Call the corresponding VOL callback */ if ((cls->request_cls.specific)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6725,7 +9376,7 @@ H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t /* Call the corresponding internal VOL routine */ 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") + "unable to execute asynchronous request 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6747,7 +9398,7 @@ H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xi*!", req, connector_id, args); /* Get class pointer */ @@ -6757,10 +9408,10 @@ H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t /* Call the corresponding internal VOL routine */ if (H5VL__request_specific(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request specific callback") + "unable to execute asynchronous request 'specific' callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_specific() */ /*------------------------------------------------------------------------- @@ -6791,7 +9442,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t /* Call the corresponding VOL callback */ if ((cls->request_cls.optional)(req, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6820,7 +9471,7 @@ H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args) /* Call the corresponding internal VOL routine */ 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") + "unable to execute asynchronous request 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -6842,7 +9493,7 @@ 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 + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE3("e", "*xi*!", req, connector_id, args); /* Get class pointer */ @@ -6852,10 +9503,10 @@ H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args) /* Call the corresponding internal VOL routine */ if (H5VL__request_optional(req, cls, args) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, - "unable to execute asynchronous request optional callback") + "unable to execute asynchronous request 'optional' callback") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_optional() */ /*------------------------------------------------------------------------- @@ -6889,7 +9540,7 @@ H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *arg /* 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request 'optional' callback") done: FUNC_LEAVE_API(ret_value) @@ -6972,7 +9623,7 @@ H5VLrequest_free(void *req, hid_t connector_id) H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE2("e", "*xi", req, connector_id); /* Get class pointer */ @@ -6984,7 +9635,7 @@ H5VLrequest_free(void *req, hid_t connector_id) HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "unable to free request") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLrequest_free() */ /*------------------------------------------------------------------------- @@ -7068,7 +9719,7 @@ H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void * H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xi*xz*x*x", obj, connector_id, buf, size, blob_id, ctx); /* Get class pointer */ @@ -7082,7 +9733,7 @@ H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_t size, void * HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_put() */ /*------------------------------------------------------------------------- @@ -7163,7 +9814,7 @@ H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf /*out H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE6("e", "*xi*xxz*x", obj, connector_id, blob_id, buf, size, ctx); /* Get class pointer */ @@ -7177,7 +9828,7 @@ H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf /*out HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_get() */ /*------------------------------------------------------------------------- @@ -7210,7 +9861,7 @@ H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob /* Call the corresponding VOL callback */ if ((cls->blob_cls.specific)(obj, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7239,7 +9890,7 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specif /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'specific' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7260,7 +9911,7 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args); /* Get class pointer */ @@ -7274,7 +9925,7 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_specific() */ /*------------------------------------------------------------------------- @@ -7307,7 +9958,7 @@ H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_opti /* Call the corresponding VOL callback */ if ((cls->blob_cls.optional)(obj, blob_id, args) < 0) - HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7336,7 +9987,7 @@ H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_ar /* Call the corresponding internal VOL routine */ 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") + HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob 'optional' callback") done: FUNC_LEAVE_NOAPI(ret_value) @@ -7357,7 +10008,7 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_ar H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args); /* Get class pointer */ @@ -7371,7 +10022,7 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_ar HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLblob_optional() */ /*------------------------------------------------------------------------- @@ -7479,7 +10130,7 @@ H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5 H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*k*k*Is", obj, connector_id, token1, token2, cmp_value); /* Check args and get class pointer */ @@ -7495,7 +10146,7 @@ H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1, const H5 HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "object token comparison failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLtoken_cmp() */ /*------------------------------------------------------------------------- @@ -7584,7 +10235,7 @@ H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_t H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xIti*k**s", obj, obj_type, connector_id, token, token_str); /* Check args and get class pointer */ @@ -7602,7 +10253,7 @@ H5VLtoken_to_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const H5O_t HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "object token to string failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLtoken_to_str() */ /*------------------------------------------------------------------------- @@ -7691,7 +10342,7 @@ H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const cha H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xIti*s*k", obj, obj_type, connector_id, token_str, token); /* Check args and get class pointer */ @@ -7709,7 +10360,7 @@ H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector_id, const cha HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "object token from string failed") done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLtoken_from_str() */ /*------------------------------------------------------------------------- @@ -7735,7 +10386,7 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, h /* Call the corresponding VOL callback */ if ((ret_value = (cls->optional)(obj, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: FUNC_LEAVE_NOAPI(ret_value) @@ -7766,7 +10417,7 @@ H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dx /* Call the corresponding internal VOL routine */ 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"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: /* Reset object wrapping info in API context */ @@ -7792,7 +10443,7 @@ H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dx H5VL_class_t *cls; /* VOL connector's class struct */ herr_t ret_value = SUCCEED; /* Return value */ - FUNC_ENTER_API_NOINIT + FUNC_ENTER_API_WRAPPER(FAIL) H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req); /* Check args and get class pointer */ @@ -7803,8 +10454,8 @@ H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dx /* Call the corresponding internal VOL routine */ if ((ret_value = H5VL__optional(obj, cls, args, dxpl_id, req)) < 0) - HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback"); + HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute generic 'optional' callback"); done: - FUNC_LEAVE_API_NOINIT(ret_value) + FUNC_LEAVE_API_WRAPPER(ret_value) } /* end H5VLoptional() */ diff --git a/src/H5VLint.c b/src/H5VLint.c index 70c8112..956dad3 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -917,7 +917,7 @@ done: *------------------------------------------------------------------------- */ H5VL_object_t * -H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id) +H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t wrap_obj) { H5VL_class_t * cls = NULL; /* VOL connector class */ H5VL_t * connector = NULL; /* VOL connector struct */ @@ -940,8 +940,7 @@ H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id) conn_id_incr = TRUE; /* Set up VOL object for the passed-in data */ - /* (Wraps object, since it's a library object) */ - if (NULL == (ret_value = H5VL__new_vol_obj(type, obj, connector, TRUE))) + if (NULL == (ret_value = H5VL__new_vol_obj(type, obj, connector, wrap_obj))) HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, NULL, "can't create VOL object") done: @@ -1041,7 +1040,7 @@ done: * *------------------------------------------------------------------------- */ -hsize_t +size_t H5VL_object_inc_rc(H5VL_object_t *vol_obj) { FUNC_ENTER_NOAPI_NOERR_NOFS @@ -1086,6 +1085,59 @@ done: } /* end H5VL_free_object() */ /*------------------------------------------------------------------------- + * Function: H5VL_fapl_is_native + * + * Purpose: Query if a FAPL will use the native VOL connector. + * + * Return: SUCCEED/FAIL + * + * Programmer: Quincey Koziol + * Jun 17, 2021 + * + *------------------------------------------------------------------------- + */ +herr_t +H5VL_fapl_is_native(hid_t fapl_id, hbool_t *is_native) +{ + H5P_genplist_t * fapl_plist; /* Property list pointer */ + H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */ + H5VL_class_t * cls; /* VOL class structure for callback info */ + const H5VL_class_t * native_cls; /* Native VOL connector class structs */ + int cmp_value; /* Comparison result */ + herr_t ret_value = SUCCEED; + + FUNC_ENTER_NOAPI(FAIL) + + /* Check for default property list value */ + if (H5P_DEFAULT == fapl_id) + fapl_id = H5P_FILE_ACCESS_DEFAULT; + + /* Get the VOL info from the fapl */ + if (NULL == (fapl_plist = (H5P_genplist_t *)H5I_object(fapl_id))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a file access property list") + if (H5P_peek(fapl_plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector info") + + /* Get the connector's class */ + if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_prop.connector_id, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not a VOL connector ID") + + /* Retrieve the native connector class */ + if (NULL == (native_cls = (H5VL_class_t *)H5I_object_verify(H5VL_NATIVE, H5I_VOL))) + HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve native VOL connector class") + + /* Compare connector classes */ + if (H5VL_cmp_connector_cls(&cmp_value, cls, native_cls) < 0) + HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "can't compare connector classes") + + /* If classes compare equal, then the object is / is in a native connector's file */ + *is_native = (cmp_value == 0); + +done: + FUNC_LEAVE_NOAPI(ret_value) +} /* end H5VL_fapl_is_native() */ + +/*------------------------------------------------------------------------- * Function: H5VL_object_is_native * * Purpose: Query if an object is (if it's a file object) / is in (if its @@ -1099,7 +1151,7 @@ done: *------------------------------------------------------------------------- */ herr_t -H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) +H5VL_object_is_native(const H5VL_object_t *obj, H5VL_get_conn_lvl_t lvl, hbool_t *is_native) { const H5VL_class_t *cls; /* VOL connector class structs for object */ const H5VL_class_t *native_cls; /* Native VOL connector class structs */ @@ -1114,7 +1166,7 @@ H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native) /* Retrieve the terminal connector class for the object */ cls = NULL; - if (H5VL_introspect_get_conn_cls(obj, H5VL_GET_CONN_LVL_TERM, &cls) < 0) + if (H5VL_introspect_get_conn_cls(obj, lvl, &cls) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get VOL connector class") /* Retrieve the native connector class */ diff --git a/src/H5VLnative.c b/src/H5VLnative.c index 18b5b9c..bdac930 100644 --- a/src/H5VLnative.c +++ b/src/H5VLnative.c @@ -385,7 +385,7 @@ H5VLnative_addr_to_token(hid_t loc_id, haddr_t addr, H5O_token_t *token) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Make sure that the VOL object is a native connector object */ - if (H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj_container, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") @@ -479,7 +479,7 @@ H5VLnative_token_to_addr(hid_t loc_id, H5O_token_t token, haddr_t *addr) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier") /* Make sure that the VOL object is a native connector object */ - if (H5VL_object_is_native(vol_obj_container, &is_native_vol_obj) < 0) + if (H5VL_object_is_native(vol_obj_container, H5VL_GET_CONN_LVL_TERM, &is_native_vol_obj) < 0) HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if VOL object is native connector object") diff --git a/src/H5VLnative.h b/src/H5VLnative.h index fe8ede2..42dc7bd 100644 --- a/src/H5VLnative.h +++ b/src/H5VLnative.h @@ -281,6 +281,12 @@ typedef struct H5VL_native_file_set_libver_bounds_t { H5F_libver_t high; /* Highest version possible */ } H5VL_native_file_set_libver_bounds_t; +/* Parameters for native connector's file 'post open' operation */ +typedef struct H5VL_native_file_post_open_t { + void * vol_obj; /* VOL object for "top" file object */ + hbool_t id_exists; /* Whether an ID (will) exists for this file */ +} H5VL_native_file_post_open_t; + /* Parameters for native connector's file 'optional' operations */ typedef union H5VL_native_file_optional_args_t { /* H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE */ @@ -392,7 +398,7 @@ typedef union H5VL_native_file_optional_args_t { #endif /* H5_HAVE_PARALLEL */ /* H5VL_NATIVE_FILE_POST_OPEN */ - /* No args */ + H5VL_native_file_post_open_t post_open; } H5VL_native_file_optional_args_t; /* Values for native VOL connector group optional VOL operations */ diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c index 1e674dc..64e18e9 100644 --- a/src/H5VLnative_file.c +++ b/src/H5VLnative_file.c @@ -92,7 +92,6 @@ H5VL__native_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t /* Create the file */ if (NULL == (new_file = H5F_open(name, flags, fcpl_id, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create file") - new_file->id_exists = TRUE; ret_value = (void *)new_file; @@ -126,7 +125,6 @@ H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t H5 /* Open the file */ if (NULL == (new_file = H5F_open(name, flags, H5P_FILE_CREATE_DEFAULT, fapl_id))) HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to open file") - new_file->id_exists = TRUE; ret_value = (void *)new_file; @@ -719,7 +717,7 @@ H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_ /* Finalize H5Fopen */ case H5VL_NATIVE_FILE_POST_OPEN: { /* Call package routine */ - if (H5F__post_open(f) < 0) + if (H5F__post_open(f, opt_args->post_open.vol_obj, opt_args->post_open.id_exists) < 0) HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file") break; } @@ -752,15 +750,12 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U FUNC_ENTER_PACKAGE - /* This routine should only be called when a file ID's ref count drops to zero */ - HDassert(H5F_ID_EXISTS(f)); - /* Flush file if this is the last reference to this id and we have write * intent, unless it will be flushed by the "shared" file being closed. * This is only necessary to replicate previous behaviour, and could be * disabled by an option/property to improve performance. */ - if ((H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { + if (H5F_ID_EXISTS(f) && (H5F_NREFS(f) > 1) && (H5F_INTENT(f) & H5F_ACC_RDWR)) { /* Get the file ID corresponding to the H5F_t struct */ if (H5I_find_id(f, H5I_FILE, &file_id) < 0 || H5I_INVALID_HID == file_id) HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "invalid ID") diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h index f929d03..65ef37c 100644 --- a/src/H5VLprivate.h +++ b/src/H5VLprivate.h @@ -97,12 +97,14 @@ H5_DLL void *H5VL_object_unwrap(const H5VL_object_t *vol_obj); H5_DLL void *H5VL_object_verify(hid_t id, H5I_type_t obj_type); H5_DLL H5VL_object_t *H5VL_vol_object(hid_t id); H5_DLL H5VL_object_t *H5VL_create_object(void *object, H5VL_t *vol_connector); -H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id); -H5_DLL hsize_t H5VL_object_inc_rc(H5VL_object_t *obj); +H5_DLL H5VL_object_t *H5VL_create_object_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, + hbool_t wrap_obj); +H5_DLL size_t H5VL_object_inc_rc(H5VL_object_t *obj); H5_DLL herr_t H5VL_free_object(H5VL_object_t *obj); -H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, hbool_t *is_native); -H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, - hbool_t *same_file); +H5_DLL herr_t H5VL_fapl_is_native(hid_t fapl_id, hbool_t *is_native); +H5_DLL herr_t H5VL_object_is_native(const H5VL_object_t *obj, H5VL_get_conn_lvl_t lvl, hbool_t *is_native); +H5_DLL herr_t H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2, + hbool_t *same_file); /* Functions that wrap / unwrap VOL objects */ H5_DLL herr_t H5VL_get_wrap_ctx(const H5VL_class_t *connector, void *obj, void **wrap_ctx); @@ -206,12 +208,12 @@ H5_DLL herr_t H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_ar H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req); /* File functions */ -H5_DLL void * H5VL_file_create(const H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, - hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL void * H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags, - hid_t fapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id, - void **req); +H5_DLL hid_t H5VL_file_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, + void **req); +H5_DLL H5VL_object_t *H5VL_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, + void **req, hid_t *ret_id); +H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id, + void **req); H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, @@ -236,11 +238,11 @@ H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void H5_DLL herr_t 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); -H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, - const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, +H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); -H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1, - const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2, +H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *src_loc_params, + const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *dst_loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req); H5_DLL herr_t 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); @@ -250,7 +252,7 @@ H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_pa H5VL_optional_args_t *args, hid_t dxpl_id, void **req); /* Object functions */ -H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params, +H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type, hid_t dxpl_id, void **req); H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name, const H5VL_object_t *dst_obj, diff --git a/src/H5VLtest.c b/src/H5VLtest.c index 1f99ce5..998ec8d 100644 --- a/src/H5VLtest.c +++ b/src/H5VLtest.c @@ -31,9 +31,12 @@ /***********/ /* Headers */ /***********/ -#include "H5private.h" /* Generic Functions */ -#include "H5Eprivate.h" /* Error handling */ -#include "H5VLpkg.h" /* Virtual Object Layer */ +#include "H5private.h" /* Generic Functions */ +#include "H5Eprivate.h" /* Error handling */ +#include "H5Fprivate.h" /* Files */ +#include "H5Iprivate.h" /* IDs */ +#include "H5Pprivate.h" /* Property lists */ +#include "H5VLpkg.h" /* Virtual Object Layer */ /****************/ /* Local Macros */ diff --git a/src/H5private.h b/src/H5private.h index f29ec02..60fec4f 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -2018,6 +2018,7 @@ extern hbool_t H5_MPEinit_g; /* Has the MPE Library been initialized? */ /* Forward declaration of H5CXpush() / H5CXpop() */ /* (Including H5CXprivate.h creates bad circular dependencies - QAK, 3/18/2018) */ H5_DLL herr_t H5CX_push(void); +H5_DLL herr_t H5CX_test_and_push(hbool_t *pushed); H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #ifndef NDEBUG @@ -2176,6 +2177,28 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ { +/* + * Use this macro for public API functions for the various "plugin" wrappers. + * Examples are: public VOL callback wrappers (e.g. H5VLfile_create, + * H5VLdataset_read, etc.), public VFD callback wrappers (e.g. H5FDopen, + * H5FDread, etc.), etc. + * + */ +#define FUNC_ENTER_API_WRAPPER(err) \ + { \ + { \ + { \ + hbool_t pushed = FALSE; \ + \ + FUNC_ENTER_API_COMMON \ + H5_PUSH_FUNC \ + /* Push an API context, if there isn't already one */ \ + if (H5CX_test_and_push(&pushed) < 0) \ + HGOTO_ERROR(H5E_FUNC, H5E_CANTSET, err, "can't set API context") \ + \ + BEGIN_MPE_LOG \ + { + /* Note: this macro only works when there's _no_ interface initialization routine for the module */ #define FUNC_ENTER_NOAPI_INIT(err) \ /* Initialize the package, if appropriate */ \ @@ -2433,6 +2456,20 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); } \ } /*end scope from beginning of FUNC_ENTER*/ +/* Use this macro to match the FUNC_ENTER_API_WRAPPER macro */ +#define FUNC_LEAVE_API_WRAPPER(ret_value) \ + FUNC_LEAVE_API_COMMON(ret_value); \ + if (pushed) \ + (void)H5CX_pop(TRUE); \ + H5_POP_FUNC \ + if (err_occurred) \ + (void)H5E_dump_api_stack(TRUE); \ + FUNC_LEAVE_API_THREADSAFE \ + return (ret_value); \ + } \ + } \ + } /*end scope from beginning of FUNC_ENTER*/ + #define FUNC_LEAVE_NOAPI(ret_value) \ ; \ } /*end scope from end of FUNC_ENTER*/ \ diff --git a/src/Makefile.am b/src/Makefile.am index ce6e3b1..c0a98ce 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -157,7 +157,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers # Public component author headers include_HEADERS += H5ESdevelop.h H5FDdevelop.h H5Idevelop.h H5Ldevelop.h \ - H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h + H5Pdevelop.h H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h # install libhdf5.settings in lib directory settingsdir=$(libdir) |