summaryrefslogtreecommitdiffstats
path: root/src/H5D.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/H5D.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/H5D.c')
-rw-r--r--src/H5D.c391
1 files changed, 260 insertions, 131 deletions
diff --git a/src/H5D.c b/src/H5D.c
index aa09f5f..7d0e934 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -557,8 +557,9 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_
{
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
- (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -566,11 +567,17 @@ H5D__get_space_api_common(hid_t dset_id, void **token_ptr, H5VL_object_t **_vol_
if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE;
+ vol_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get the dataspace */
- if (H5VL_dataset_get(*vol_obj_ptr, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, token_ptr,
- &ret_value) < 0)
+ if (H5VL_dataset_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_space.space_id;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__get_space_api_common() */
@@ -591,7 +598,7 @@ done:
hid_t
H5Dget_space(hid_t dset_id)
{
- 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", dset_id);
@@ -664,8 +671,9 @@ done:
herr_t
H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dset_id, allocation);
@@ -674,9 +682,12 @@ H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_SPACE_STATUS;
+ vol_cb_args.args.get_space_status.status = allocation;
+
/* Get dataspace status */
- if ((ret_value = H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE_STATUS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, allocation)) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get space status")
done:
@@ -699,8 +710,9 @@ done:
hid_t
H5Dget_type(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
@@ -709,11 +721,17 @@ H5Dget_type(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_TYPE;
+ vol_cb_args.args.get_type.type_id = H5I_INVALID_HID;
+
/* Get the datatype */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_type.type_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_type() */
@@ -737,8 +755,9 @@ done:
hid_t
H5Dget_create_plist(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
@@ -747,11 +766,17 @@ H5Dget_create_plist(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_DCPL;
+ vol_cb_args.args.get_dcpl.dcpl_id = H5I_INVALID_HID;
+
/* Get the dataset creation property list */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset creation properties")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_dcpl.dcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_create_plist() */
@@ -792,8 +817,9 @@ done:
hid_t
H5Dget_access_plist(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", dset_id);
@@ -802,11 +828,17 @@ H5Dget_access_plist(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_DAPL;
+ vol_cb_args.args.get_dapl.dapl_id = H5I_INVALID_HID;
+
/* Get the dataset access property list */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_DAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataset access properties")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_dapl.dapl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_access_plist() */
@@ -829,8 +861,10 @@ done:
hsize_t
H5Dget_storage_size(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- hsize_t ret_value = 0; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hsize_t storage_size = 0; /* Storage size of dataset */
+ hsize_t ret_value = 0; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", dset_id);
@@ -839,11 +873,17 @@ H5Dget_storage_size(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_GET_STORAGE_SIZE;
+ vol_cb_args.args.get_storage_size.storage_size = &storage_size;
+
/* Get the storage size */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, 0, "unable to get storage size")
+ /* Set return value */
+ ret_value = storage_size;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_storage_size() */
@@ -862,8 +902,11 @@ done:
haddr_t
H5Dget_offset(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- haddr_t ret_value = HADDR_UNDEF; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ haddr_t dset_offset = HADDR_UNDEF; /* Dataset's offset */
+ haddr_t ret_value = HADDR_UNDEF; /* Return value */
FUNC_ENTER_API(HADDR_UNDEF)
H5TRACE1("a", "i", dset_id);
@@ -872,11 +915,18 @@ H5Dget_offset(hid_t dset_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, HADDR_UNDEF, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_offset.offset = &dset_offset;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_OFFSET;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the offset */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_OFFSET, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, HADDR_UNDEF, "unable to get offset")
+ /* Set return value */
+ ret_value = dset_offset;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dget_offset() */
@@ -941,7 +991,11 @@ done:
*
* The MEM_SPACE_ID can be the constant H5S_ALL in which case
* the memory dataspace is the same as the file dataspace
- * defined when the dataset was created.
+ * defined when the dataset was created. The MEM_SPACE_ID can
+ * also be the constant H5S_BLOCK, which indicates that the
+ * buffer provided is a single contiguous block of memory, with
+ * the same # of elements as specified in the FILE_SPACE_ID
+ * selection.
*
* The number of elements in the memory dataspace must match
* the number of elements in the file dataspace.
@@ -1032,13 +1086,15 @@ done:
*---------------------------------------------------------------------------
*/
herr_t
-H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf)
+H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *filters, void *buf /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE5("e", "ii*h*Iu*x", dset_id, dxpl_id, offset, filters, buf);
+ H5TRACE5("e", "ii*h*Iux", dset_id, dxpl_id, offset, filters, buf);
/* Check arguments */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
@@ -1056,11 +1112,20 @@ H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset, uint32_t *fil
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+ /* Set up VOL callback arguments */
+ dset_opt_args.chunk_read.offset = offset;
+ dset_opt_args.chunk_read.filters = 0;
+ dset_opt_args.chunk_read.buf = buf;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_READ;
+ vol_cb_args.args = &dset_opt_args;
+
/* Read the raw chunk */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_READ, dxpl_id, H5_REQUEST_NULL, offset,
- filters, buf) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
+ /* Set return value */
+ *filters = dset_opt_args.chunk_read.filters;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Dread_chunk() */
@@ -1126,7 +1191,11 @@ done:
*
* The MEM_SPACE_ID can be the constant H5S_ALL in which case
* the memory dataspace is the same as the file dataspace
- * defined when the dataset was created.
+ * defined when the dataset was created. The MEM_SPACE_ID can
+ * also be the constant H5S_BLOCK, which indicates that the
+ * buffer provided is a single contiguous block of memory, with
+ * the same # of elements as specified in the FILE_SPACE_ID
+ * selection.
*
* The number of elements in the memory dataspace must match
* the number of elements in the file dataspace.
@@ -1222,9 +1291,11 @@ herr_t
H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *offset, size_t data_size,
const void *buf)
{
- H5VL_object_t *vol_obj = NULL;
- uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ uint32_t data_size_32; /* Chunk data size (limited to 32-bits currently) */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iiIu*hz*x", dset_id, dxpl_id, filters, offset, data_size, buf);
@@ -1250,9 +1321,16 @@ H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, const hsize_t *of
else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+ /* Set up VOL callback arguments */
+ dset_opt_args.chunk_write.offset = offset;
+ dset_opt_args.chunk_write.filters = filters;
+ dset_opt_args.chunk_write.size = data_size_32;
+ dset_opt_args.chunk_write.buf = buf;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_WRITE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Write chunk */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_CHUNK_WRITE, dxpl_id, H5_REQUEST_NULL, filters,
- offset, data_size_32, buf) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
done:
@@ -1348,7 +1426,7 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_
done:
/* Release selection iterator */
if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator")
if (iter)
iter = H5FL_FREE(H5S_sel_iter_t, iter);
@@ -1447,7 +1525,7 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf
done:
/* Release selection iterator */
if (iter_init && H5S_SELECT_ITER_RELEASE(iter) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "Can't release selection iterator")
+ HDONE_ERROR(H5E_DATASET, H5E_CANTFREE, FAIL, "can't release selection iterator")
if (iter)
iter = H5FL_FREE(H5S_sel_iter_t, iter);
@@ -1642,9 +1720,18 @@ H5Dvlen_get_buf_size(hid_t dataset_id, hid_t type_id, hid_t space_id, hsize_t *s
&supported) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't check for 'get vlen buf size' operation")
if (supported & H5VL_OPT_QUERY_SUPPORTED) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_vlen_buf_size.type_id = type_id;
+ dset_opt_args.get_vlen_buf_size.space_id = space_id;
+ dset_opt_args.get_vlen_buf_size.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Make the 'get_vlen_buf_size' callback */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, type_id, space_id, size) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get vlen buf size")
} /* end if */
else {
@@ -1673,7 +1760,8 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr
H5VL_object_t * tmp_vol_obj = NULL; /* Object for loc_id */
H5VL_object_t **vol_obj_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1687,9 +1775,12 @@ H5D__set_extent_api_common(hid_t dset_id, const hsize_t size[], void **token_ptr
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_SET_EXTENT;
+ vol_cb_args.args.set_extent.size = size;
+
/* Set the extent */
- if ((ret_value = H5VL_dataset_specific(*vol_obj_ptr, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT,
- token_ptr, size)) < 0)
+ if (H5VL_dataset_specific(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set dataset extent")
done:
@@ -1775,8 +1866,9 @@ done:
herr_t
H5Dflush(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
@@ -1789,12 +1881,15 @@ H5Dflush(hid_t dset_id)
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_FLUSH;
+ vol_cb_args.args.flush.dset_id = dset_id;
+
/* Flush dataset information cached in memory
* XXX: Note that we need to pass the ID to the VOL since the H5F_flush_cb_t
* callback needs it and that's in the public API.
*/
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_FLUSH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_id)) < 0)
+ if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
done:
@@ -1802,41 +1897,6 @@ done:
} /* H5Dflush */
/*-------------------------------------------------------------------------
- * Function: H5Dwait
- *
- * Purpose: Wait for all operations on a dataset.
- * Tang: added for async
- *
- * Return: Non-negative on success/Negative on failure
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Dwait(hid_t dset_id)
-{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", dset_id);
-
- /* Check args */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dset_id parameter is not a valid dataset identifier")
-
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(dset_id) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
-
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_WAIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_id)) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTOPERATE, FAIL, "unable to wait dataset")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5Dwait*/
-
-/*-------------------------------------------------------------------------
* Function: H5Drefresh
*
* Purpose: Refreshes all buffers associated with a dataset.
@@ -1848,8 +1908,9 @@ done:
herr_t
H5Drefresh(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
@@ -1862,9 +1923,12 @@ H5Drefresh(hid_t dset_id)
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATASET_REFRESH;
+ vol_cb_args.args.refresh.dset_id = dset_id;
+
/* Refresh the dataset object */
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_REFRESH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_id)) < 0)
+ if (H5VL_dataset_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
done:
@@ -1891,8 +1955,9 @@ done:
herr_t
H5Dformat_convert(hid_t dset_id)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", dset_id);
@@ -1905,9 +1970,12 @@ H5Dformat_convert(hid_t dset_id)
if (H5CX_set_loc(dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_FORMAT_CONVERT;
+ vol_cb_args.args = NULL;
+
/* Convert the dataset */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_INTERNAL, FAIL, "can't convert dataset format")
done:
@@ -1929,8 +1997,10 @@ done:
herr_t
H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", dset_id, idx_type);
@@ -1941,9 +2011,13 @@ H5Dget_chunk_index_type(hid_t dset_id, H5D_chunk_index_t *idx_type /*out*/)
if (NULL == idx_type)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "idx_type parameter cannot be NULL")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_idx_type.idx_type = idx_type;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the chunk indexing type */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, idx_type) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk index type")
done:
@@ -1968,8 +2042,10 @@ done:
herr_t
H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_nbytes /*out*/)
{
- H5VL_object_t *vol_obj; /* Dataset for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "i*hx", dset_id, offset, chunk_nbytes);
@@ -1982,9 +2058,14 @@ H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hsize_t *chunk_n
if (NULL == chunk_nbytes)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "chunk_nbytes parameter cannot be NULL")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_storage_size.offset = offset;
+ dset_opt_args.get_chunk_storage_size.size = chunk_nbytes;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the dataset creation property list */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, offset, chunk_nbytes) < 0)
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
done:
@@ -2015,8 +2096,10 @@ done:
herr_t
H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iix", dset_id, fspace_id, nchunks);
@@ -2027,10 +2110,15 @@ H5Dget_num_chunks(hid_t dset_id, hid_t fspace_id, hsize_t *nchunks /*out*/)
if (NULL == nchunks)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_num_chunks.space_id = fspace_id;
+ dset_opt_args.get_num_chunks.nchunks = nchunks;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_NUM_CHUNKS;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the number of written chunks */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fspace_id, nchunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks")
done:
FUNC_LEAVE_API(ret_value);
@@ -2062,9 +2150,11 @@ herr_t
H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *offset /*out*/,
unsigned *filter_mask /*out*/, haddr_t *addr /*out*/, hsize_t *size /*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- hsize_t nchunks = 0;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ hsize_t nchunks = 0; /* Number of chunks */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "iihxxxx", dset_id, fspace_id, chk_index, offset, filter_mask, addr, size);
@@ -2076,19 +2166,33 @@ H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_index, hsize_t *of
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_num_chunks.space_id = fspace_id;
+ dset_opt_args.get_num_chunks.nchunks = &nchunks;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_NUM_CHUNKS;
+ vol_cb_args.args = &dset_opt_args;
+
/* Get the number of written chunks to check range */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_NUM_CHUNKS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fspace_id, &nchunks) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get number of chunks")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks")
/* Check range for chunk index */
if (chk_index >= nchunks)
HGOTO_ERROR(H5E_DATASET, H5E_BADRANGE, FAIL, "chunk index is out of range")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_info_by_idx.space_id = fspace_id;
+ dset_opt_args.get_chunk_info_by_idx.chk_index = chk_index;
+ dset_opt_args.get_chunk_info_by_idx.offset = offset;
+ dset_opt_args.get_chunk_info_by_idx.filter_mask = filter_mask;
+ dset_opt_args.get_chunk_info_by_idx.addr = addr;
+ dset_opt_args.get_chunk_info_by_idx.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX;
+ vol_cb_args.args = &dset_opt_args;
+
/* Call private function to get the chunk info given the chunk's index */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fspace_id, chk_index, offset, filter_mask, addr, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by index")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index")
done:
FUNC_LEAVE_API(ret_value);
@@ -2119,8 +2223,10 @@ herr_t
H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filter_mask /*out*/,
haddr_t *addr /*out*/, hsize_t *size /*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*hxxx", dset_id, offset, filter_mask, addr, size);
@@ -2134,10 +2240,17 @@ H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, unsigned *filte
if (NULL == offset)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument (null)")
+ /* Set up VOL callback arguments */
+ dset_opt_args.get_chunk_info_by_coord.offset = offset;
+ dset_opt_args.get_chunk_info_by_coord.filter_mask = filter_mask;
+ dset_opt_args.get_chunk_info_by_coord.addr = addr;
+ dset_opt_args.get_chunk_info_by_coord.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD;
+ vol_cb_args.args = &dset_opt_args;
+
/* Call private function to get the chunk info given the chunk's index */
- if (H5VL_dataset_optional(vol_obj, H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, offset, filter_mask, addr, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't get chunk info by its logical coordinates")
+ if (H5VL_dataset_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates")
done:
FUNC_LEAVE_API(ret_value)
@@ -2150,6 +2263,7 @@ done:
*
* Parameters:
* hid_t dset_id; IN: Chunked dataset ID
+ * hid_t dxpl_id; IN: Dataset transfer property list ID
* H5D_chunk_iter_op_t cb IN: User callback function, called for every chunk.
* void *op_data IN/OUT: Optional user data passed on to user callback.
*
@@ -2187,22 +2301,37 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Dchunk_iter(hid_t dset_id, H5D_chunk_iter_op_t cb, void *op_data)
+H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t op, void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* Dataset for this operation */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj = NULL; /* Dataset for this operation */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_dataset_optional_args_t dset_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
- H5TRACE3("e", "ix*x", dset_id, cb, op_data);
+ H5TRACE4("e", "iix*x", dset_id, dxpl_id, op, op_data);
/* Check arguments */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(dset_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid dataset identifier")
+ if (NULL == op)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid callback to chunk iteration")
- /* Call private function to get the chunk info given the chunk's index */
- if (H5VL_dataset_specific(vol_obj, H5VL_DATASET_CHUNK_ITER, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, cb,
- op_data) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "Can't iterate over chunks")
+ /* Get the default dataset transfer property list if the user didn't provide one */
+ if (H5P_DEFAULT == dxpl_id)
+ dxpl_id = H5P_DATASET_XFER_DEFAULT;
+ else if (TRUE != H5P_isa_class(dxpl_id, H5P_DATASET_XFER))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "dxpl_id is not a dataset transfer property list ID")
+
+ /* Set up VOL callback arguments */
+ dset_opt_args.chunk_iter.op = op;
+ dset_opt_args.chunk_iter.op_data = op_data;
+ vol_cb_args.op_type = H5VL_NATIVE_DATASET_CHUNK_ITER;
+ vol_cb_args.args = &dset_opt_args;
+
+ /* Iterate over the chunks */
+ if ((ret_value = H5VL_dataset_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
+ HERROR(H5E_BADITER, H5E_BADITER, "error iterating over dataset chunks");
done:
FUNC_LEAVE_API(ret_value)