summaryrefslogtreecommitdiffstats
path: root/src/H5VLint.c
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@lbl.gov>2021-06-02 20:29:46 (GMT)
committerGitHub <noreply@github.com>2021-06-02 20:29:46 (GMT)
commit4b7f34acc16c7d071a5c1d4519ba2a01354e51db (patch)
tree944c634b581e30979afd91ef05fcef4db4a062da /src/H5VLint.c
parent88a83d56c07f7c462d1866a2a2642a9f2e37dd22 (diff)
downloadhdf5-4b7f34acc16c7d071a5c1d4519ba2a01354e51db.zip
hdf5-4b7f34acc16c7d071a5c1d4519ba2a01354e51db.tar.gz
hdf5-4b7f34acc16c7d071a5c1d4519ba2a01354e51db.tar.bz2
Combo set of async and other changes (#161)
* Update API tracing for new H5VL_request_status_t typedef * Finish converting internal event set operations to use list iterator callbacks, instead of directly accessing the list structure * Add H5VL_REQUEST_GET_ERR_STACK operation to request subclass, for retrieving a copy of the error stack for a failed asynchronous operation * Remove 'canceled' event status from Java constants * Be safer about releasing resources when inserting a newly opened/created object or file into an event set * Remove H5EStest, add H5ES_WAIT_NONE for 0 timeout, and revise parameters to H5ESwait, to make it more "aggregate". * Remove H5ES_STATUS_CANCELED from Java wrappers also * Apply patch for dynamically registering optional VOL operations * (a) Add async APIs for H5O module as listed in jira issue ID-283. (b) Remove verification of name parameter in async related routines for H55A and H5L modules because it is checked in H5VL_setup* routine. (c) Modify h5dump expected output due to the async changes. * Corrections based on PR feedback. * Further changes to make based on PR feedback. * Remove H5Dwait & H5Fwait (moved to the async connector). Added H5atclose routine. Updated 'optional op' operations. * Fix missed merge marker, and reformatted line * Update API tracing infrastructure for H5atclose callback * Clean up some warnings * Normalize against develop branch * Correct level of indirection * Add doxygen info for H5is_library_terminating and regression tests for it and H5atclose * Relocate prototype (and doxygen info) for H5Aclose * Align w/changes on develop * Move group package initialization code to H5Gint.c, and update tracing macros * Change non-static function declarations to be static * Correct GCC diagnostic macro * Ensure that H5TSpublic.h header gets installed (#129) * Finish moving API routines that invoke VOL framework to main source files. * Fix position of H5Fmount and H5Funmount * Add 'wrapper' versions of async calls, to allow language wrappers and layers on top of HDF5 to pass in their application information. * Add wrappers for dynamically registered optional operations * Fix typo * Update doxygen comment for H5atclose with additional detail. * Add H5VL\*_vararg versions of H5VL routines that use va_list parameters * Implement and test H5S_BLOCK * Switch H5Aexists\*_async and H5Lexists\*_async to use flag to return status, instead of return value. Make the corresponding changes through most of the v1 and v2 B-tree code. Clean up warnings in H5public.h and cmpd_dtransform.c. * Add H5Iregister_future routine and tests. * Correct return value for H5Lexists_async * Add H5_DLL macro to public H5ES API routines * Update supported -> flags parameter for introspect_query callback * Remove my email address. Update passthrough VOL connector ID. * Fix comment for post_open_api_common * Remove unused non-blocking VOL connector * Minor cleanup in async branch in preparation for merge to develop * Update CMake and the Autotools to use the new pass-through VOL ID * Finish another iteration on public H5ES routines, along with running the code reformatter * Another round of reformatting * Fix for SWMR daily test failures (#160) The H5I_register_using_existing_id() call did not initialize the future ID callbacks, causing the library to segfault when it tried to resolve those function pointers. * Added selective async APIs (#150) * Added selective async APIs Description: Added the following APIs: H5Ropen_attr_async H5Ropen_object_async H5Ropen_region_async H5Mcreate_async H5Mopen_async H5Mput_async H5Mget_async H5Mclose_async H5Tcommit_async H5Topen_async H5Tcopy_async H5Tclose_async - Updated an expected output file to include a new internal function in the error stack for the failure case. * Updated async APIs per reviews, including removing async version of H5Tcopy. * Removed statements that were added by mistake in the previous commit. * Fix compile issues in H5M and warnings elsewhere * Reformat code * Brings VOL_LIST changes from develop. (#163) * Remove H5Dwait and H5Fwait calls, which were incorrectly brought back in * Tiny cleanup of H5Lcreate_hard_async * Run source formatter * Allow for canceled operation in wait_cb * Attempt to fix switch on string value * Re-run source formatter * Add H5S_BLOCK testfile to CMake clean target * Add H5Pset_vol_async API routine and 'get_cap_flags' VOL introspection callback * Clean up warnings * Add H5P(set\|get)_vol_implicit_async API routines to allow \/ disallow implicit asynchronous operations (default is disallowed) * Run formatting script * Remove H5VL_REQUEST_WAIT\* * Warning cleanup * Eliminate strdup()s on statically allocated strings * Warning cleanup * Split H5VLrestore_lib_state into H5VLstart_lib_state and H5VLrestore_lib_state, and rename H5VLreset_lib_state to H5VLfinish_lib_state. * Duplicate strings when building err_info to return to applicatin * Move connector author routines into seperate header files, all included in the new hdf5dev.h header * Run bin/trace to add TRACE macros * Allow H5ES_NONE as a valid, but no-op, parameter to all H5ES API routines that accept an event set ID * Clean up formatting * Remove H5Pset/get_vol_implicit_async * Clean up warning * Remove H5Pget_vol_async and replace with more generic H5Pget_vol_cap_flags * Clean up warnings * Add H5ESfree_err_info convenience routine * Fix typo * Correct matching for cached VOL plugins * Add developer header file * Update for C99 compatibility * Add missing trace macro * Stop clang-format from messing with the trace macros. Don't set up VOL wrappers for 'infrastructure' objects like requests and blobs * Fix warning about formatting a directory * Clean up formatting for H5E_BEGIN_TRY / H5E_END_TRY * Reduce scope of H5ES__close * Enable CMake checks for various types on MacOS * Clean up properly when H5CX_retrieve_state() fails. Also clean up many compiler warnings. * Committing clang-format changes * Merge from develop * Fix mis-placed assert * Remove commented-out code * Re-add macro for unsetenv on Windows (I think it accidentally was merged out) * Strengthen sanity check from error report to assertion * Committing clang-format changes * Add units to the comments for a few fields * Switch 'get execution time' operation for async request tokens to be an optional operation and query if connector supports operation before retrieving it. * Committing clang-format changes * Remove H5ESget_time_estimate * Committing clang-format changes * Create developer header for datatype routines and move type conversion register/unregister routines there. * Simplify internal H5VL_setup_name_args and H5VL_setup_idx_args routines * Add H5VLlink_optional_op, allowing dynamicly registered optional operations for the link VOL subclass, also added H5VL_loc_params argument to the link 'optional' callback to allow them to work correctly. * Run bin/format_source on current code * Add H5VLobject_optional_op, allowing dynamicly registered optional operations for the object VOL subclass, also added H5VL_loc_params argument to the object 'optional' callback to allow them to work correctly. * Run bin/format_source on current code * Committing clang-format changes * Revert "Switch 'get execution time' operation for async request tokens to be an optional operation and query if connector supports operation before retrieving it." This reverts commit 5ac92014da2682bdba62d7a2524b8d90e38f6b19. * Committing clang-format changes * Convert attribute 'get' operation to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Update tracing macros * Convert attribute 'specific' operation to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert dataset 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also, minor tweaks to attribute 'get' and 'specific' operation parameters. * Convert datatype 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also, minor tweaks to H5O_refresh_metadata arguments. * Reduce warnings * Reduce warnings * Track change to datatype 'get' callback * Fix bug with file pointer getting invalidated when object closed * Reformat source * Convert file and group VOL classes 'get' and 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also small cleanup to the attribute get name operation. Also moved 'mount' and 'unmount' operations to be group specific operations, instead of file specific, to better align with their behavior (mounted files are on groups, so a group is what is operated on). * Remove remainder of merge conflict marking * Convert link VOL class 'create' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Remove some unused local variables * Convert link VOL class 'get' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also refactor 'get name by idx' routines to return actual length of name with a parameter instead of the return value, and move some callback context structs for the link interface from the private header file into the source code module, to reduce their visibility scope. * Update tracing macros * Convert link VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert object VOL class 'get' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert object VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also refactor H5G_loc_exists, et al, to return 'exists' flag in a parameter and errors with the function return value, instead of overloading both into the return value. And, corrected logic error in test/links.c around non-existant objects in a file. * Convert request VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. * Convert blob VOL class 'specific' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Also removes the H5VL_BLOB_GETSIZE operation, as it's unused in the library and the blob ID size for a container is now returned with H5VL_FILE_GET_CONT_INFO. * Add 'const' to several parameters that are only queried. * Convert all VOL classes' 'optional' operations to use struct-of-tagged-union pattern for VOL callback arguments, instead of using varargs. Convert several 'get' routines to return the length of an array in a parameter instead of combining it into the return value. Move several routines to be in less public namespace. Correct direct_chunk test to verify that parameters aren't modified on error. * Switch get/specific/optional VOL callback argument structures to be 'async-friendly'. Also other minor cleanups and bug-fixes. * Add H5Pset_dataset_io_hyperslab_selection / H5S_PLIST feature, to allow skipping H5Dget_space + H5Sselect_hyperslab for async operation * Add dynamic optional operations for request objects * Update dynamic operation test for optional request operations * Update a comment for an operation argument * Run trace and format_source scripts * Committing clang-format changes * Committing clang-format changes Co-authored-by: vchoi <vchoi@jelly.ad.hdfgroup.org> Co-authored-by: vchoi-hdfgroup <55293060+vchoi-hdfgroup@users.noreply.github.com> Co-authored-by: jhendersonHDF <jhenderson@hdfgroup.org> Co-authored-by: Dana Robinson <derobins@hdfgroup.org> Co-authored-by: Dana Robinson <43805+derobins@users.noreply.github.com> Co-authored-by: bmribler <39579120+bmribler@users.noreply.github.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/H5VLint.c')
-rw-r--r--src/H5VLint.c270
1 files changed, 210 insertions, 60 deletions
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 500e075..70c8112 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -88,7 +88,6 @@ typedef struct {
/********************/
static herr_t H5VL__free_cls(H5VL_class_t *cls, void **request);
static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
-static herr_t H5VL__set_def_conn(void);
static void * H5VL__wrap_obj(void *obj, H5I_type_t obj_type);
static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector,
hbool_t wrap_obj);
@@ -194,6 +193,10 @@ H5VL_init_phase2(void)
if (H5M_init() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize map interface")
+ /* Sanity check default VOL connector */
+ HDassert(H5VL_def_conn_s.connector_id == (-1));
+ HDassert(H5VL_def_conn_s.connector_info == NULL);
+
/* Set up the default VOL connector in the default FAPL */
if (H5VL__set_def_conn() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector")
@@ -261,15 +264,22 @@ H5VL_term_package(void)
n++;
} /* end if */
else {
- /* Destroy the VOL connector ID group */
- n += (H5I_dec_type_ref(H5I_VOL) > 0);
-
- /* Mark interface as closed */
- if (0 == n)
- H5_PKG_INIT_VAR = FALSE;
- } /* end else */
- } /* end else */
- } /* end if */
+ if (H5VL__num_opt_operation() > 0) {
+ /* Unregister all dynamically registered optional operations */
+ (void)H5VL__term_opt_operation();
+ n++;
+ } /* end if */
+ else {
+ /* Destroy the VOL connector ID group */
+ n += (H5I_dec_type_ref(H5I_VOL) > 0);
+
+ /* Mark interface as closed */
+ if (0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ } /* end else */
+ } /* end else */
+ } /* end else */
+ } /* end if */
FUNC_LEAVE_NOAPI(n)
} /* end H5VL_term_package() */
@@ -365,7 +375,7 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5VL__set_def_conn(void)
{
H5P_genplist_t *def_fapl; /* Default file access property list */
@@ -376,11 +386,16 @@ H5VL__set_def_conn(void)
void * vol_info = NULL; /* VOL connector info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
- /* Sanity check */
- HDassert(H5VL_def_conn_s.connector_id == (-1));
- HDassert(H5VL_def_conn_s.connector_info == NULL);
+ /* Reset default VOL connector, if it's set already */
+ /* (Can happen during testing -QAK) */
+ if (H5VL_def_conn_s.connector_id > 0) {
+ /* Release the default VOL connector */
+ (void)H5VL_conn_free(&H5VL_def_conn_s);
+ H5VL_def_conn_s.connector_id = -1;
+ H5VL_def_conn_s.connector_info = NULL;
+ } /* end if */
/* Check for environment variable set */
env_var = HDgetenv("HDF5_VOL_CONNECTOR");
@@ -760,51 +775,47 @@ done:
} /* end H5VL_register_using_existing_id() */
/*-------------------------------------------------------------------------
- * Function: H5VL_register_using_vol_id
+ * Function: H5VL_new_connector
*
- * Purpose: Utility function to create a user ID for an object created
- * or opened through the VOL. Uses the VOL connector's ID to
- * get the connector information instead of it being passed in.
+ * Purpose: Utility function to create a connector for a connector ID.
*
- * Return: Success: A valid HDF5 ID
- * Failure: H5I_INVALID_HID
+ * Return: Success: Pointer to a new connector object
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref)
+H5VL_t *
+H5VL_new_connector(hid_t connector_id)
{
- H5VL_class_t *cls = NULL; /* VOL connector class */
- H5VL_t * connector = NULL; /* VOL connector struct */
- hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_class_t *cls = NULL; /* VOL connector class */
+ H5VL_t * connector = NULL; /* New VOL connector struct */
+ hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
+ H5VL_t * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(NULL)
/* Get the VOL class object from the connector's ID */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID")
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Setup VOL info struct */
if (NULL == (connector = H5FL_CALLOC(H5VL_t)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL connector struct")
connector->cls = cls;
connector->id = connector_id;
if (H5I_inc_ref(connector->id, FALSE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector")
conn_id_incr = TRUE;
- /* Get an ID for the VOL object */
- if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+ /* Set return value */
+ ret_value = connector;
done:
/* Clean up on error */
- if (ret_value < 0) {
+ if (NULL == ret_value) {
/* Decrement VOL connector ID ref count on error */
if (conn_id_incr && H5I_dec_ref(connector_id) < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID,
- "unable to decrement ref count on VOL connector")
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector")
/* Free VOL connector struct */
if (NULL != connector)
@@ -812,6 +823,45 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_new_connector() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register_using_vol_id
+ *
+ * Purpose: Utility function to create a user ID for an object created
+ * or opened through the VOL. Uses the VOL connector's ID to
+ * get the connector information instead of it being passed in.
+ *
+ * Return: Success: A valid HDF5 ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref)
+{
+ H5VL_t *connector = NULL; /* VOL connector struct */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Create new VOL connector object, using the connector ID */
+ if (NULL == (connector = H5VL_new_connector(connector_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't create VOL connector object")
+
+ /* Get an ID for the VOL object */
+ if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+
+done:
+ /* Clean up on error */
+ if (H5I_INVALID_HID == ret_value)
+ /* Release newly created connector */
+ if (connector && H5VL_conn_dec_rc(connector) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID,
+ "unable to decrement ref count on VOL connector")
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_register_using_vol_id() */
/*-------------------------------------------------------------------------
@@ -1125,15 +1175,20 @@ H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2,
if (cmp_value)
*same_file = FALSE;
else {
- void *obj2; /* Terminal object for second file */
+ void * obj2; /* Terminal object for second file */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get unwrapped (terminal) object for vol_obj2 */
if (NULL == (obj2 = H5VL_object_data(vol_obj2)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object")
- /* Make callback */
- if (H5VL_file_specific(vol_obj1, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, obj2,
- same_file) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_EQUAL;
+ vol_cb_args.args.is_equal.obj2 = obj2;
+ vol_cb_args.args.is_equal.same_file = same_file;
+
+ /* Make 'are files equal' callback */
+ if (H5VL_file_specific(vol_obj1, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
} /* end else */
@@ -2047,6 +2102,36 @@ done:
} /* end H5VL_retrieve_lib_state() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_start_lib_state
+ *
+ * Purpose: Opens a new internal state for the HDF5 library.
+ *
+ * Note: Currently just pushes a new API context state, but could be
+ * expanded in the future.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 5, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_start_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Push a new API context on the stack */
+ if (H5CX_push() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_start_lib_state() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_restore_lib_state
*
* Purpose: Restore the state of the library.
@@ -2071,10 +2156,6 @@ H5VL_restore_lib_state(const void *state)
/* Sanity checks */
HDassert(state);
- /* Push a new API context on the stack */
- if (H5CX_push() < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
-
/* Restore the API context state */
if (H5CX_restore_state((const H5CX_state_t *)state) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context state")
@@ -2084,16 +2165,16 @@ done:
} /* end H5VL_restore_lib_state() */
/*-------------------------------------------------------------------------
- * Function: H5VL_reset_lib_state
+ * Function: H5VL_finish_lib_state
*
- * Purpose: Reset the state of the library, undoing affects of
- * H5VL_restore_lib_state.
+ * Purpose: Closes the state of the library, undoing affects of
+ * H5VL_start_lib_state.
*
* Note: Currently just resets the API context state, but could be
* expanded in the future.
*
* Note: This routine must be called as a "pair" with
- * H5VL_restore_lib_state. It can be called before / after /
+ * H5VL_start_lib_state. It can be called before / after /
* independently of H5VL_free_lib_state.
*
* Return: SUCCEED / FAIL
@@ -2104,7 +2185,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_reset_lib_state(void)
+H5VL_finish_lib_state(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2116,7 +2197,7 @@ H5VL_reset_lib_state(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_reset_lib_state() */
+} /* end H5VL_finish_lib_state() */
/*-------------------------------------------------------------------------
* Function: H5VL_free_lib_state
@@ -2484,6 +2565,33 @@ done:
} /* end H5VL_check_plugin_load() */
/*-------------------------------------------------------------------------
+ * Function: H5VL__is_default_conn
+ *
+ * Purpose: Check if the default connector will be used for a container.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL__is_default_conn(hid_t fapl_id, hid_t connector_id, hbool_t *is_default)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(is_default);
+
+ /* Determine if the default VOL connector will be used, based on non-default
+ * values in the FAPL, connector ID, or the HDF5_VOL_CONNECTOR environment
+ * variable being set.
+ */
+ *is_default = (H5VL_def_conn_s.connector_id == H5_DEFAULT_VOL) &&
+ ((H5P_FILE_ACCESS_DEFAULT == fapl_id) || connector_id == H5_DEFAULT_VOL);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL__is_default_conn() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_setup_args
*
* Purpose: Set up arguments to access an object
@@ -2506,7 +2614,7 @@ H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj)
if (NULL == (*vol_obj = (H5VL_object_t *)H5I_object_verify(loc_id, id_type)))
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID")
- /* Set up collective metadata (if appropriate */
+ /* Set up collective metadata (if appropriate) */
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read")
@@ -2631,8 +2739,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libclass, hbool_t is_collective,
- hid_t acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+H5VL_setup_name_args(hid_t loc_id, const char *name, hbool_t is_collective, hid_t lapl_id,
+ H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2649,7 +2757,7 @@ H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libcl
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
- if (H5CX_set_apl(&acspl_id, libclass, loc_id, is_collective) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
@@ -2659,7 +2767,7 @@ H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libcl
/* Set up location parameters */
loc_params->type = H5VL_OBJECT_BY_NAME;
loc_params->loc_data.loc_by_name.name = name;
- loc_params->loc_data.loc_by_name.lapl_id = acspl_id;
+ loc_params->loc_data.loc_by_name.lapl_id = lapl_id;
loc_params->obj_type = H5I_get_type(loc_id);
done:
@@ -2677,8 +2785,8 @@ done:
*/
herr_t
H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- const H5P_libclass_t *libclass, hbool_t is_collective, hid_t acspl_id,
- H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+ hbool_t is_collective, hid_t lapl_id, H5VL_object_t **vol_obj,
+ H5VL_loc_params_t *loc_params)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2699,7 +2807,7 @@ H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
- if (H5CX_set_apl(&acspl_id, libclass, loc_id, is_collective) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
@@ -2712,7 +2820,7 @@ H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter
loc_params->loc_data.loc_by_idx.idx_type = idx_type;
loc_params->loc_data.loc_by_idx.order = order;
loc_params->loc_data.loc_by_idx.n = n;
- loc_params->loc_data.loc_by_idx.lapl_id = acspl_id;
+ loc_params->loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params->obj_type = H5I_get_type(loc_id);
done:
@@ -2752,3 +2860,45 @@ H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_setup_token_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_get_cap_flags
+ *
+ * Purpose: Query capability flags for connector property.
+ *
+ * Note: VOL connector set with HDF5_VOL_CONNECTOR overrides the
+ * property passed in.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_get_cap_flags(const H5VL_connector_prop_t *connector_prop, unsigned *cap_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(connector_prop);
+
+ /* Copy the connector ID & info, if there is one */
+ if (connector_prop->connector_id > 0) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if (NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Query the connector's capability flags */
+ if (H5VL_introspect_get_cap_flags(connector_prop->connector_info, connector, cap_flags) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector ID not set?")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_get_cap_flags() */