summaryrefslogtreecommitdiffstats
path: root/src/H5Gdeprec.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/H5Gdeprec.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/H5Gdeprec.c')
-rw-r--r--src/H5Gdeprec.c291
1 files changed, 171 insertions, 120 deletions
diff --git a/src/H5Gdeprec.c b/src/H5Gdeprec.c
index 45065e8..7c0404f 100644
--- a/src/H5Gdeprec.c
+++ b/src/H5Gdeprec.c
@@ -308,7 +308,8 @@ done:
herr_t
H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iLl*s*s", cur_loc_id, type, cur_name, new_name);
@@ -326,20 +327,15 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
/* Create link */
if (type == H5L_TYPE_HARD) {
H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params1;
- H5VL_loc_params_t loc_params2;
+ H5VL_loc_params_t new_loc_params;
H5VL_object_t tmp_vol_obj; /* Temporary object */
- loc_params1.type = H5VL_OBJECT_BY_NAME;
- loc_params1.obj_type = H5I_get_type(cur_loc_id);
- loc_params1.loc_data.loc_by_name.name = cur_name;
- loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ /* Set up new location struct */
+ new_loc_params.type = H5VL_OBJECT_BY_NAME;
+ new_loc_params.loc_data.loc_by_name.name = new_name;
+ new_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
- loc_params2.type = H5VL_OBJECT_BY_NAME;
- loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
-
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -347,16 +343,24 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
tmp_vol_obj.data = NULL;
tmp_vol_obj.connector = vol_obj->connector;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD;
+ vol_cb_args.args.hard.curr_obj = vol_obj->data;
+ vol_cb_args.args.hard.curr_loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.hard.curr_loc_params.obj_type = H5I_get_type(cur_loc_id);
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.name = cur_name;
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- vol_obj->data, &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, &tmp_vol_obj, &new_loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if (type == H5L_TYPE_SOFT) {
H5VL_object_t * vol_obj; /* Object of loc_id */
H5VL_loc_params_t loc_params;
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = new_name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
@@ -366,10 +370,13 @@ H5Glink(hid_t cur_loc_id, H5G_link_t type, const char *cur_name, const char *new
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT;
+ vol_cb_args.args.soft.target = cur_name;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- cur_name) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@@ -390,7 +397,8 @@ done:
herr_t
H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_id, const char *new_name)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sLli*s", cur_loc_id, cur_name, type, new_loc_id, new_name);
@@ -409,29 +417,31 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_
if (type == H5L_TYPE_HARD) {
H5VL_object_t * vol_obj1; /* Object of loc_id */
H5VL_object_t * vol_obj2; /* Object of loc_id */
- H5VL_loc_params_t loc_params1;
- H5VL_loc_params_t loc_params2;
+ H5VL_loc_params_t new_loc_params;
- loc_params1.type = H5VL_OBJECT_BY_NAME;
- loc_params1.obj_type = H5I_get_type(cur_loc_id);
- loc_params1.loc_data.loc_by_name.name = cur_name;
- loc_params1.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ /* Set up new location struct */
+ new_loc_params.type = H5VL_OBJECT_BY_NAME;
+ new_loc_params.obj_type = H5I_get_type(new_loc_id);
+ new_loc_params.loc_data.loc_by_name.name = new_name;
+ new_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
- loc_params2.type = H5VL_OBJECT_BY_NAME;
- loc_params2.obj_type = H5I_get_type(new_loc_id);
- loc_params2.loc_data.loc_by_name.name = new_name;
- loc_params2.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
-
- /* get the location object */
+ /* Get the location objects */
if (NULL == (vol_obj1 = (H5VL_object_t *)H5I_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
if (NULL == (vol_obj2 = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD;
+ vol_cb_args.args.hard.curr_obj = vol_obj1->data;
+ vol_cb_args.args.hard.curr_loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.hard.curr_loc_params.obj_type = H5I_get_type(cur_loc_id);
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.name = cur_name;
+ vol_cb_args.args.hard.curr_loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, vol_obj2, &loc_params2, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- vol_obj1->data, &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj2, &new_loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else if (type == H5L_TYPE_SOFT) {
@@ -443,6 +453,7 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_
if (new_loc_id == H5L_SAME_LOC)
new_loc_id = cur_loc_id;
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = new_name;
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
@@ -452,10 +463,13 @@ H5Glink2(hid_t cur_loc_id, const char *cur_name, H5G_link_t type, hid_t new_loc_
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT;
+ vol_cb_args.args.soft.target = cur_name;
+
/* Create the link through the VOL */
- if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
- H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- cur_name) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, H5P_LINK_CREATE_DEFAULT,
+ H5P_LINK_ACCESS_DEFAULT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else-if */
else
@@ -572,9 +586,10 @@ done:
herr_t
H5Gunlink(hid_t loc_id, const char *name)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
@@ -596,9 +611,11 @@ H5Gunlink(hid_t loc_id, const char *name)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_DELETE;
+
/* Delete the link */
- if (H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTDELETE, FAIL, "couldn't delete link")
done:
@@ -616,9 +633,10 @@ done:
herr_t
H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*szx", loc_id, name, size, buf);
@@ -631,6 +649,7 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/)
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = name;
@@ -640,9 +659,13 @@ H5Gget_linkval(hid_t loc_id, const char *name, size_t size, char *buf /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_VAL;
+ vol_cb_args.args.get_val.buf = buf;
+ vol_cb_args.args.get_val.buf_size = size;
+
/* Get the link value */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_VAL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, buf,
- size) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -669,9 +692,11 @@ done:
herr_t
H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*s*s", loc_id, name, comment);
@@ -693,9 +718,14 @@ H5Gset_comment(hid_t loc_id, const char *name, const char *comment)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.set_comment.comment = comment;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_SET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* Set the comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_SET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "unable to set comment value")
done:
@@ -728,10 +758,12 @@ done:
int
H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t op_ret; /* Return value from operation */
- int ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5VL_loc_params_t loc_params;
+ size_t comment_len = 0; /* Length of comment */
+ int ret_value; /* Return value */
FUNC_ENTER_API(-1)
H5TRACE4("Is", "i*szx", loc_id, name, bufsize, buf);
@@ -755,13 +787,20 @@ H5Gget_comment(hid_t loc_id, const char *name, size_t bufsize, char *buf /*out*/
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, -1, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_comment.buf = buf;
+ obj_opt_args.get_comment.buf_size = bufsize;
+ obj_opt_args.get_comment.comment_len = &comment_len;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_COMMENT;
+ vol_cb_args.args = &obj_opt_args;
+
/* Get the comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, buf, bufsize, &op_ret) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, -1, "unable to get comment value")
/* Set return value */
- ret_value = (int)op_ret;
+ ret_value = (int)comment_len;
done:
FUNC_LEAVE_API(ret_value)
@@ -794,12 +833,11 @@ done:
herr_t
H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *op_data)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5G_link_iterate_t lnk_op; /* Link operator */
- hsize_t last_obj; /* Index of last object looked at */
- hsize_t idx; /* Internal location to hold index */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_group_optional_args_t grp_opt_args; /* Arguments for optional operation */
+ hsize_t last_obj = 0; /* Pointer to index value */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*IsGi*x", loc_id, name, idx_p, op, op_data);
@@ -812,30 +850,28 @@ H5Giterate(hid_t loc_id, const char *name, int *idx_p, H5G_iterate_t op, void *o
if (!op)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no operator specified")
- /* Set number of objects looked at to zero */
- last_obj = 0;
- idx = (hsize_t)(idx_p == NULL ? 0 : *idx_p);
-
- /* Build link operator info */
- lnk_op.op_type = H5G_LINK_OP_OLD;
- lnk_op.op_func.op_old = op;
-
- /* Fill out location struct */
- 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 = H5P_LINK_ACCESS_DEFAULT;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object pointer */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ID, H5E_BADTYPE, (-1), "invalid identifier")
+ /* Set up VOL callback arguments */
+ grp_opt_args.iterate_old.loc_params.type = H5VL_OBJECT_BY_NAME;
+ grp_opt_args.iterate_old.loc_params.loc_data.loc_by_name.name = name;
+ grp_opt_args.iterate_old.loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ grp_opt_args.iterate_old.loc_params.obj_type = H5I_get_type(loc_id);
+ grp_opt_args.iterate_old.idx = (hsize_t)(idx_p == NULL ? 0 : *idx_p);
+ grp_opt_args.iterate_old.last_obj = &last_obj;
+ grp_opt_args.iterate_old.op = op;
+ grp_opt_args.iterate_old.op_data = op_data;
+ vol_cb_args.op_type = H5VL_NATIVE_GROUP_ITERATE_OLD;
+ vol_cb_args.args = &grp_opt_args;
+
/* Call private iteration function, through VOL callback */
- if ((ret_value = H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, idx, &last_obj, &lnk_op, op_data)) < 0)
+ if ((ret_value = H5VL_group_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) <
+ 0)
HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
- /* Set the index we stopped at */
+ /* Set value to return */
if (idx_p)
*idx_p = (int)last_obj;
@@ -862,11 +898,11 @@ done:
herr_t
H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs /*out*/)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5I_type_t id_type; /* Type of ID */
- H5VL_loc_params_t loc_params;
- H5G_info_t grp_info; /* Group information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5I_type_t id_type; /* Type of ID */
+ H5G_info_t grp_info; /* Group information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", loc_id, num_objs);
@@ -878,17 +914,14 @@ H5Gget_num_objs(hid_t loc_id, hsize_t *num_objs /*out*/)
if (!num_objs)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "bad pointer to # of objects")
- /* Fill in location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = id_type;
-
- /* Get group location */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback & object access arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_INFO;
+ if (H5VL_setup_self_args(loc_id, &vol_obj, &vol_cb_args.args.get_info.loc_params) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set object access arguments")
+ vol_cb_args.args.get_info.ginfo = &grp_info;
/* Retrieve the group's information */
- if (H5VL_group_get(vol_obj, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- &grp_info) < 0)
+ if (H5VL_group_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
/* Set the number of objects [i.e. links] in the group */
@@ -918,9 +951,10 @@ done:
herr_t
H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *statbuf /*out*/)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_group_optional_args_t grp_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE4("e", "i*sbx", loc_id, name, follow_link, statbuf);
@@ -933,20 +967,22 @@ H5Gget_objinfo(hid_t loc_id, const char *name, hbool_t follow_link, H5G_stat_t *
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info");
- /* Retrieve object info */
- /* Fill out location struct */
- 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 = H5P_LINK_ACCESS_DEFAULT;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the location object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier");
+ /* Set up VOL callback arguments */
+ grp_opt_args.get_objinfo.loc_params.type = H5VL_OBJECT_BY_NAME;
+ grp_opt_args.get_objinfo.loc_params.loc_data.loc_by_name.name = name;
+ grp_opt_args.get_objinfo.loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
+ grp_opt_args.get_objinfo.loc_params.obj_type = H5I_get_type(loc_id);
+ grp_opt_args.get_objinfo.follow_link = follow_link;
+ grp_opt_args.get_objinfo.statbuf = statbuf;
+ vol_cb_args.op_type = H5VL_NATIVE_GROUP_GET_OBJINFO;
+ vol_cb_args.args = &grp_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_group_optional(vol_obj, H5VL_NATIVE_GROUP_GET_OBJINFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &loc_params, (unsigned)follow_link, statbuf) < 0)
+ if (H5VL_group_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get info for object: '%s'", name);
done:
@@ -1138,9 +1174,11 @@ done:
ssize_t
H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ size_t name_len = 0; /* Length of object name */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("Zs", "ihxz", loc_id, idx, name, size);
@@ -1149,7 +1187,7 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, (-1), "can't set collective metadata read info")
- /* Fill in location struct fields */
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = ".";
loc_params.loc_data.loc_by_idx.idx_type = H5_INDEX_NAME;
@@ -1162,11 +1200,19 @@ H5Gget_objname_by_idx(hid_t loc_id, hsize_t idx, char *name /*out*/, size_t size
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_NAME;
+ vol_cb_args.args.get_name.name_size = size;
+ vol_cb_args.args.get_name.name = name;
+ vol_cb_args.args.get_name.name_len = &name_len;
+
/* Call internal function */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- name, size, &ret_value) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get object name")
+ /* Set the return value */
+ ret_value = (ssize_t)name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_objname_by_idx() */
@@ -1189,10 +1235,11 @@ done:
H5G_obj_t
H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_info2_t oinfo; /* Object info (contains object type) */
- H5G_obj_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5O_info2_t oinfo; /* Object info (contains object type) */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE2("Go", "ih", loc_id, idx);
@@ -1210,9 +1257,13 @@ H5Gget_objtype_by_idx(hid_t loc_id, hsize_t idx)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5G_UNKNOWN, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = &oinfo;
+ vol_cb_args.args.get_info.fields = H5O_INFO_BASIC;
+
/* Retrieve the object's basic information (which includes its type) */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &oinfo, H5O_INFO_BASIC) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_BADTYPE, H5G_UNKNOWN, "can't get object info")
/* Map to group object type */