summaryrefslogtreecommitdiffstats
path: root/src/H5VLnative_file.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/H5VLnative_file.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/H5VLnative_file.c')
-rw-r--r--src/H5VLnative_file.c387
1 files changed, 157 insertions, 230 deletions
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index fd86414..1e674dc 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -15,8 +15,15 @@
*
*/
+/****************/
+/* Module Setup */
+/****************/
+
#define H5F_FRIEND /* Suppress error about including H5Fpkg */
+/***********/
+/* Headers */
+/***********/
#include "H5private.h" /* Generic Functions */
#include "H5ACprivate.h" /* Metadata cache */
#include "H5Cprivate.h" /* Cache */
@@ -31,6 +38,30 @@
#include "H5VLnative_private.h" /* Native VOL connector */
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
/*-------------------------------------------------------------------------
* Function: H5VL__native_file_create
*
@@ -116,21 +147,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_file_get(void *obj, H5VL_file_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5F_t *f = NULL; /* File struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
+ switch (args->op_type) {
/* "get container info" */
case H5VL_FILE_GET_CONT_INFO: {
- H5VL_file_cont_info_t *info = HDva_arg(arguments, H5VL_file_cont_info_t *);
-
- /* Retrieve the file's container info */
- if (H5F__get_cont_info((H5F_t *)obj, info) < 0)
+ if (H5F__get_cont_info((H5F_t *)obj, args->args.get_cont_info.info) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file container info")
break;
@@ -138,31 +166,22 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Fget_access_plist */
case H5VL_FILE_GET_FAPL: {
- H5P_genplist_t *new_plist; /* New property list */
- hid_t * plist_id = HDva_arg(arguments, hid_t *);
-
- f = (H5F_t *)obj;
-
- /* Retrieve the file's access property list */
- if ((*plist_id = H5F_get_access_plist(f, TRUE)) < 0)
+ if ((args->args.get_fapl.fapl_id = H5F_get_access_plist((H5F_t *)obj, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get file access property list")
- if (NULL == (new_plist = (H5P_genplist_t *)H5I_object(*plist_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
break;
}
/* H5Fget_create_plist */
case H5VL_FILE_GET_FCPL: {
H5P_genplist_t *plist; /* Property list */
- hid_t * plist_id = HDva_arg(arguments, hid_t *);
f = (H5F_t *)obj;
if (NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Create the property list object to return */
- if ((*plist_id = H5P_copy_plist(plist, TRUE)) < 0)
+ if ((args->args.get_fcpl.fcpl_id = H5P_copy_plist(plist, TRUE)) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINIT, FAIL, "unable to copy file creation properties")
break;
@@ -170,8 +189,6 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Fget_intent */
case H5VL_FILE_GET_INTENT: {
- unsigned *intent_flags = HDva_arg(arguments, unsigned *);
-
f = (H5F_t *)obj;
/* HDF5 uses some flags internally that users don't know about.
@@ -179,18 +196,18 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
* or H5F_ACC_RDONLY and any SWMR flags.
*/
if (H5F_INTENT(f) & H5F_ACC_RDWR) {
- *intent_flags = H5F_ACC_RDWR;
+ *args->args.get_intent.flags = H5F_ACC_RDWR;
/* Check for SWMR write access on the file */
if (H5F_INTENT(f) & H5F_ACC_SWMR_WRITE)
- *intent_flags |= H5F_ACC_SWMR_WRITE;
+ *args->args.get_intent.flags |= H5F_ACC_SWMR_WRITE;
} /* end if */
else {
- *intent_flags = H5F_ACC_RDONLY;
+ *args->args.get_intent.flags = H5F_ACC_RDONLY;
/* Check for SWMR read access on the file */
if (H5F_INTENT(f) & H5F_ACC_SWMR_READ)
- *intent_flags |= H5F_ACC_SWMR_READ;
+ *args->args.get_intent.flags |= H5F_ACC_SWMR_READ;
} /* end else */
break;
@@ -198,71 +215,52 @@ H5VL__native_file_get(void *obj, H5VL_file_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Fget_fileno */
case H5VL_FILE_GET_FILENO: {
- unsigned long *fno = HDva_arg(arguments, unsigned long *);
- unsigned long my_fileno = 0;
+ unsigned long fileno = 0;
- f = (H5F_t *)obj;
- H5F_GET_FILENO(f, my_fileno);
- *fno = my_fileno; /* sigh */
+ H5F_GET_FILENO((H5F_t *)obj, fileno);
+ *args->args.get_fileno.fileno = fileno;
break;
}
/* H5Fget_name */
case H5VL_FILE_GET_NAME: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- size_t size = HDva_arg(arguments, size_t);
- char * name = HDva_arg(arguments, char *);
- ssize_t * ret = HDva_arg(arguments, ssize_t *);
- size_t len;
+ H5VL_file_get_name_args_t *file_args = &args->args.get_name;
- if (H5VL_native_get_file_struct(obj, type, &f) < 0)
+ if (H5VL_native_get_file_struct(obj, file_args->type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- len = HDstrlen(H5F_OPEN_NAME(f));
+ /* Get length of file name */
+ *file_args->file_name_len = HDstrlen(H5F_OPEN_NAME(f));
- if (name) {
- HDstrncpy(name, H5F_OPEN_NAME(f), MIN(len + 1, size));
- if (len >= size)
- name[size - 1] = '\0';
+ /* Populate buffer with name, if given */
+ if (file_args->buf) {
+ HDstrncpy(file_args->buf, H5F_OPEN_NAME(f),
+ MIN(*file_args->file_name_len + 1, file_args->buf_size));
+ if (*file_args->file_name_len >= file_args->buf_size)
+ file_args->buf[file_args->buf_size - 1] = '\0';
} /* end if */
- /* Set the return value for the API call */
- *ret = (ssize_t)len;
break;
}
/* H5Fget_obj_count */
case H5VL_FILE_GET_OBJ_COUNT: {
- unsigned types = HDva_arg(arguments, unsigned);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
-
- f = (H5F_t *)obj;
- /* Perform the query */
- if (H5F_get_obj_count(f, types, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_count failed")
+ if (H5F_get_obj_count((H5F_t *)obj, args->args.get_obj_count.types, TRUE,
+ args->args.get_obj_count.count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object count")
- /* Set the return value */
- *ret = (ssize_t)obj_count;
break;
}
/* H5Fget_obj_ids */
case H5VL_FILE_GET_OBJ_IDS: {
- unsigned types = HDva_arg(arguments, unsigned);
- size_t max_objs = HDva_arg(arguments, size_t);
- hid_t * oid_list = HDva_arg(arguments, hid_t *);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t obj_count = 0; /* Number of opened objects */
+ H5VL_file_get_obj_ids_args_t *file_args = &args->args.get_obj_ids;
- f = (H5F_t *)obj;
- /* Perform the query */
- if (H5F_get_obj_ids(f, types, max_objs, oid_list, TRUE, &obj_count) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADITER, FAIL, "H5F_get_obj_ids failed")
+ if (H5F_get_obj_ids((H5F_t *)obj, file_args->types, file_args->max_objs, file_args->oid_list,
+ TRUE, file_args->count) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve object IDs")
- /* Set the return value */
- *ret = (ssize_t)obj_count;
break;
}
@@ -284,22 +282,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_file_specific(void *obj, H5VL_file_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
+ switch (args->op_type) {
/* H5Fflush */
case H5VL_FILE_FLUSH: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_scope_t scope = (H5F_scope_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_t * f = NULL; /* File to flush */
+ H5F_t *f = NULL; /* File to flush */
/* Get the file for the object */
- if (H5VL_native_get_file_struct(obj, type, &f) < 0)
+ if (H5VL_native_get_file_struct(obj, args->args.flush.obj_type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Nothing to do if the file is read only. This determination is
@@ -310,7 +306,7 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t
*/
if (H5F_ACC_RDWR & H5F_INTENT(f)) {
/* Flush other files, depending on scope */
- if (H5F_SCOPE_GLOBAL == scope) {
+ if (H5F_SCOPE_GLOBAL == args->args.flush.scope) {
/* Call the flush routine for mounted file hierarchies */
if (H5F_flush_mounts(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush mounted file hierarchy")
@@ -322,98 +318,55 @@ H5VL__native_file_specific(void *obj, H5VL_file_specific_t specific_type, hid_t
"unable to flush file's cached information")
} /* end else */
} /* end if */
+
break;
}
/* H5Freopen */
case H5VL_FILE_REOPEN: {
- void **ret = HDva_arg(arguments, void **);
- H5F_t *new_file = NULL;
+ H5F_t *new_file;
/* Reopen the file through the VOL connector */
if (NULL == (new_file = H5F__reopen((H5F_t *)obj)))
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to reopen file")
new_file->id_exists = TRUE;
- *ret = (void *)new_file;
- break;
- }
-
- /* H5Fmount */
- case H5VL_FILE_MOUNT: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- const char *name = HDva_arg(arguments, const char *);
- H5F_t * child = HDva_arg(arguments, H5F_t *);
- hid_t fmpl_id = HDva_arg(arguments, hid_t);
- H5G_loc_t loc;
-
- if (H5G_loc_real(obj, type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Do the mount */
- if (H5F__mount(&loc, name, child, fmpl_id) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
-
- break;
- }
-
- /* H5Funmount */
- case H5VL_FILE_UNMOUNT: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- const char *name = HDva_arg(arguments, const char *);
- H5G_loc_t loc;
-
- if (H5G_loc_real(obj, type, &loc) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Unmount */
- if (H5F__unmount(&loc, name) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
+ /* Set 'out' value */
+ *args->args.reopen.file = new_file;
break;
}
/* H5Fis_accessible */
case H5VL_FILE_IS_ACCESSIBLE: {
- hid_t fapl_id = HDva_arg(arguments, hid_t);
- const char *name = HDva_arg(arguments, const char *);
- htri_t * result = HDva_arg(arguments, htri_t *);
+ htri_t result;
+
+ if ((result = H5F__is_hdf5(args->args.is_accessible.filename, args->args.is_accessible.fapl_id)) <
+ 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "error in HDF5 file check")
+
+ /* Set 'out' value */
+ *args->args.is_accessible.accessible = (hbool_t)result;
- /* Call private routine */
- if ((*result = H5F__is_hdf5(name, fapl_id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "error in HDF5 file check")
break;
}
/* H5Fdelete */
case H5VL_FILE_DELETE: {
- hid_t fapl_id = HDva_arg(arguments, hid_t);
- const char *name = HDva_arg(arguments, const char *);
- herr_t * ret = HDva_arg(arguments, herr_t *);
+ if (H5F__delete(args->args.del.filename, args->args.del.fapl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file deletion")
- /* Call private routine */
- if ((*ret = H5F_delete(name, fapl_id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "error in HDF5 file check")
break;
}
/* Check if two files are the same */
case H5VL_FILE_IS_EQUAL: {
- H5F_t * file2 = (H5F_t *)HDva_arg(arguments, void *);
- hbool_t *is_equal = HDva_arg(arguments, hbool_t *);
-
- if (!obj || !file2)
- *is_equal = FALSE;
+ if (!obj || !args->args.is_equal.obj2)
+ *args->args.is_equal.same_file = FALSE;
else
- *is_equal = (((H5F_t *)obj)->shared == file2->shared);
- break;
- }
+ *args->args.is_equal.same_file =
+ (((H5F_t *)obj)->shared == ((H5F_t *)args->args.is_equal.obj2)->shared);
- /* H5Fwait */
- case H5VL_FILE_WAIT: {
- /* The native VOL connector doesn't support asynchronous
- * operations, so this is a no-op.
- */
break;
}
@@ -435,85 +388,78 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_file_optional(void *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
- H5F_t *f = NULL; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5F_t * f = (H5F_t *)obj; /* File */
+ H5VL_native_file_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- f = (H5F_t *)obj;
- switch (optional_type) {
+ switch (args->op_type) {
/* H5Fget_filesize */
case H5VL_NATIVE_FILE_GET_SIZE: {
- haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
- haddr_t base_addr; /* Base address for the file */
- hsize_t *size = HDva_arg(arguments, hsize_t *);
+ haddr_t max_eof_eoa; /* Maximum of the EOA & EOF */
+ haddr_t base_addr; /* Base address for the file */
- /* Go get the actual file size */
+ /* Get the actual file size & base address */
if (H5F__get_max_eof_eoa(f, &max_eof_eoa) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
-
base_addr = H5FD_get_base_addr(f->shared->lf);
- if (size)
- *size = (hsize_t)(max_eof_eoa +
- base_addr); /* Convert relative base address for file to absolute address */
+ /* Convert relative base address for file to absolute address */
+ *opt_args->get_size.size = (hsize_t)(max_eof_eoa + base_addr);
break;
}
/* H5Fget_file_image */
case H5VL_NATIVE_FILE_GET_FILE_IMAGE: {
- void * buf_ptr = HDva_arg(arguments, void *);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- size_t buf_len = HDva_arg(arguments, size_t);
+ H5VL_native_file_get_file_image_t *gfi_args = &opt_args->get_file_image;
- /* Do the actual work */
- if ((*ret = H5F__get_file_image(f, buf_ptr, buf_len)) < 0)
+ /* Get file image */
+ if (H5F__get_file_image(f, gfi_args->buf, gfi_args->buf_size, gfi_args->image_len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "get file image failed")
+
break;
}
/* H5Fget_freespace */
case H5VL_NATIVE_FILE_GET_FREE_SPACE: {
- hsize_t tot_space; /* Amount of free space in the file */
- hssize_t *ret = HDva_arg(arguments, hssize_t *);
+ H5VL_native_file_get_freespace_t *gfs_args = &opt_args->get_freespace;
- /* Go get the actual amount of free space in the file */
- if (H5MF_get_freespace(f, &tot_space, NULL) < 0)
+ /* Get the actual amount of free space in the file */
+ if (H5MF_get_freespace(f, gfs_args->size, NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
- *ret = (hssize_t)tot_space;
+
break;
}
/* H5Fget_free_sections */
case H5VL_NATIVE_FILE_GET_FREE_SECTIONS: {
- H5F_sect_info_t *sect_info = HDva_arg(arguments, H5F_sect_info_t *);
- ssize_t * ret = HDva_arg(arguments, ssize_t *);
- H5F_mem_t type = (H5F_mem_t)HDva_arg(arguments, int); /* enum work-around */
- size_t nsects = HDva_arg(arguments, size_t);
+ H5VL_native_file_get_free_sections_t *gfs_args = &opt_args->get_free_sections;
/* Go get the free-space section information in the file */
- if ((*ret = H5MF_get_free_sections(f, type, nsects, sect_info)) < 0)
+ if (H5MF_get_free_sections(f, gfs_args->type, gfs_args->nsects, gfs_args->sect_info,
+ gfs_args->sect_count) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to check free space for file")
+
break;
}
/* H5Fget_info1/2 */
case H5VL_NATIVE_FILE_GET_INFO: {
- H5I_type_t type = (H5I_type_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_info2_t *finfo = HDva_arg(arguments, H5F_info2_t *);
+ H5VL_native_file_get_info_t *gfi_args = &opt_args->get_info;
/* Get the file struct. This call is careful to not return the file pointer
* for the top file in a mount hierarchy.
*/
- if (H5VL_native_get_file_struct(obj, type, &f) < 0)
+ if (H5VL_native_get_file_struct(obj, gfi_args->type, &f) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get a file struct")
/* Get the file info */
- if (H5F__get_info(f, finfo) < 0)
+ if (H5F__get_info(f, gfi_args->finfo) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
break;
@@ -521,50 +467,42 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_mdc_config */
case H5VL_NATIVE_FILE_GET_MDC_CONF: {
- H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *);
+ /* Get the metadata cache configuration */
+ if (H5AC_get_cache_auto_resize_config(f->shared->cache, opt_args->get_mdc_config.config) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache configuration")
- /* Go get the resize configuration */
- if (H5AC_get_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_auto_resize_config() failed.")
break;
}
/* H5Fget_mdc_hit_rate */
case H5VL_NATIVE_FILE_GET_MDC_HR: {
- double *hit_rate_ptr = HDva_arg(arguments, double *);
+ /* Get the current hit rate */
+ if (H5AC_get_cache_hit_rate(f->shared->cache, opt_args->get_mdc_hit_rate.hit_rate) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache hit rate")
- /* Go get the current hit rate */
- if (H5AC_get_cache_hit_rate(f->shared->cache, hit_rate_ptr) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_hit_rate() failed.")
break;
}
/* H5Fget_mdc_size */
case H5VL_NATIVE_FILE_GET_MDC_SIZE: {
- size_t * max_size_ptr = HDva_arg(arguments, size_t *);
- size_t * min_clean_size_ptr = HDva_arg(arguments, size_t *);
- size_t * cur_size_ptr = HDva_arg(arguments, size_t *);
- int * cur_num_entries_ptr = HDva_arg(arguments, int *);
- uint32_t cur_num_entries;
+ H5VL_native_file_get_mdc_size_t *gms_args = &opt_args->get_mdc_size;
- /* Go get the size data */
- if (H5AC_get_cache_size(f->shared->cache, max_size_ptr, min_clean_size_ptr, cur_size_ptr,
- &cur_num_entries) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "H5AC_get_cache_size() failed.")
+ /* Get the size data */
+ if (H5AC_get_cache_size(f->shared->cache, gms_args->max_size, gms_args->min_clean_size,
+ gms_args->cur_size, gms_args->cur_num_entries) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata cache size")
- if (cur_num_entries_ptr != NULL)
- *cur_num_entries_ptr = (int)cur_num_entries;
break;
}
/* H5Fget_vfd_handle */
case H5VL_NATIVE_FILE_GET_VFD_HANDLE: {
- void **file_handle = HDva_arg(arguments, void **);
- hid_t fapl_id = HDva_arg(arguments, hid_t);
+ H5VL_native_file_get_vfd_handle_t *gvh_args = &opt_args->get_vfd_handle;
/* Retrieve the VFD handle for the file */
- if (H5F_get_vfd_handle(f, fapl_id, file_handle) < 0)
+ if (H5F_get_vfd_handle(f, gvh_args->fapl_id, gvh_args->file_handle) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve VFD handle")
+
break;
}
@@ -574,6 +512,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
if (f->shared->efc)
if (H5F__efc_release(f->shared->efc) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
+
break;
}
@@ -581,26 +520,24 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
case H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE: {
/* Reset the hit rate statistic */
if (H5AC_reset_cache_hit_rate_stats(f->shared->cache) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't reset cache hit rate")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
+
break;
}
/* H5Fset_mdc_config */
case H5VL_NATIVE_FILE_SET_MDC_CONFIG: {
- H5AC_cache_config_t *config_ptr = HDva_arg(arguments, H5AC_cache_config_t *);
+ /* Set the metadata cache configuration */
+ if (H5AC_set_cache_auto_resize_config(f->shared->cache, opt_args->set_mdc_config.config) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set metadata cache configuration")
- /* set the resize configuration */
- if (H5AC_set_cache_auto_resize_config(f->shared->cache, config_ptr) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "H5AC_set_cache_auto_resize_config() failed")
break;
}
/* H5Fget_metadata_read_retry_info */
case H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO: {
- H5F_retry_info_t *info = HDva_arg(arguments, H5F_retry_info_t *);
-
- if (H5F_get_metadata_read_retry_info(f, info) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't get metadata read retry info")
+ if (H5F_get_metadata_read_retry_info(f, opt_args->get_metadata_read_retry_info.info) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info")
break;
}
@@ -608,7 +545,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fstart_swmr_write */
case H5VL_NATIVE_FILE_START_SWMR_WRITE: {
if (H5F__start_swmr_write(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "can't start SWMR write")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't start SWMR write")
break;
}
@@ -633,11 +570,11 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_mdc_logging_status */
case H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS: {
- hbool_t *is_enabled = HDva_arg(arguments, hbool_t *);
- hbool_t *is_currently_logging = HDva_arg(arguments, hbool_t *);
+ H5VL_native_file_get_mdc_logging_status_t *gmls_args = &opt_args->get_mdc_logging_status;
/* Call mdc logging function */
- if (H5C_get_logging_status(f->shared->cache, is_enabled, is_currently_logging) < 0)
+ if (H5C_get_logging_status(f->shared->cache, gmls_args->is_enabled,
+ gmls_args->is_currently_logging) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status")
break;
@@ -667,18 +604,15 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_page_buffering_stats */
case H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS: {
- unsigned *accesses = HDva_arg(arguments, unsigned *);
- unsigned *hits = HDva_arg(arguments, unsigned *);
- unsigned *misses = HDva_arg(arguments, unsigned *);
- unsigned *evictions = HDva_arg(arguments, unsigned *);
- unsigned *bypasses = HDva_arg(arguments, unsigned *);
+ H5VL_native_file_get_page_buffering_stats_t *gpbs_args = &opt_args->get_page_buffering_stats;
/* Sanity check */
if (NULL == f->shared->page_buf)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "page buffering not enabled on file")
/* Get the statistics */
- if (H5PB_get_stats(f->shared->page_buf, accesses, hits, misses, evictions, bypasses) < 0)
+ if (H5PB_get_stats(f->shared->page_buf, gpbs_args->accesses, gpbs_args->hits, gpbs_args->misses,
+ gpbs_args->evictions, gpbs_args->bypasses) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
break;
@@ -686,11 +620,10 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_mdc_image_info */
case H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO: {
- haddr_t *image_addr = HDva_arg(arguments, haddr_t *);
- hsize_t *image_len = HDva_arg(arguments, hsize_t *);
+ H5VL_native_file_get_mdc_image_info_t *gmii_args = &opt_args->get_mdc_image_info;
/* Go get the address and size of the cache image */
- if (H5AC_get_mdc_image_info(f->shared->cache, image_addr, image_len) < 0)
+ if (H5AC_get_mdc_image_info(f->shared->cache, gmii_args->addr, gmii_args->len) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
break;
@@ -698,11 +631,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_eoa */
case H5VL_NATIVE_FILE_GET_EOA: {
- haddr_t *eoa = HDva_arg(arguments, haddr_t *);
- haddr_t rel_eoa; /* Relative address of EOA */
-
- /* Sanity check */
- HDassert(eoa);
+ haddr_t rel_eoa; /* Relative address of EOA */
/* This routine will work only for drivers with this feature enabled.*/
/* We might introduce a new feature flag in the future */
@@ -716,14 +645,13 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* Set return value */
/* (Note compensating for base address subtraction in internal routine) */
- *eoa = rel_eoa + H5F_get_base_addr(f);
+ *opt_args->get_eoa.eoa = rel_eoa + H5F_get_base_addr(f);
break;
}
/* H5Fincrement_filesize */
case H5VL_NATIVE_FILE_INCR_FILESIZE: {
- hsize_t increment = HDva_arg(arguments, hsize_t);
haddr_t max_eof_eoa; /* Maximum of the relative EOA & EOF */
/* This public routine will work only for drivers with this feature enabled.*/
@@ -737,7 +665,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "file can't get max eof/eoa ")
/* Set EOA to the maximum value + increment */
- if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + increment) < 0)
+ if (H5F__set_eoa(f, H5FD_MEM_DEFAULT, max_eof_eoa + opt_args->increment_filesize.increment) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "driver set_eoa request failed")
break;
@@ -745,11 +673,10 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fset_latest_format, H5Fset_libver_bounds */
case H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS: {
- H5F_libver_t low = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */
- H5F_libver_t high = (H5F_libver_t)HDva_arg(arguments, int); /* enum work-around */
+ H5VL_native_file_set_libver_bounds_t *slb_args = &opt_args->set_libver_bounds;
/* Call internal set_libver_bounds function */
- if (H5F__set_libver_bounds(f, low, high) < 0)
+ if (H5F__set_libver_bounds(f, slb_args->low, slb_args->high) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set low/high bounds")
break;
@@ -757,34 +684,34 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* H5Fget_dset_no_attrs_hint */
case H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG: {
- hbool_t *minimize = HDva_arg(arguments, hbool_t *);
- *minimize = H5F_GET_MIN_DSET_OHDR(f);
+ *opt_args->get_min_dset_ohdr_flag.minimize = H5F_GET_MIN_DSET_OHDR(f);
+
break;
}
/* H5Fset_dset_no_attrs_hint */
case H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG: {
- int minimize = HDva_arg(arguments, int);
- if (H5F_set_min_dset_ohdr(f, (hbool_t)minimize) < 0)
+ if (H5F_set_min_dset_ohdr(f, opt_args->set_min_dset_ohdr_flag.minimize) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL,
"cannot set file's dataset object header minimization flag")
+
break;
}
#ifdef H5_HAVE_PARALLEL
/* H5Fget_mpi_atomicity */
case H5VL_NATIVE_FILE_GET_MPI_ATOMICITY: {
- hbool_t *flag = (hbool_t *)HDva_arg(arguments, hbool_t *);
- if (H5F_get_mpi_atomicity(f, flag) < 0)
+ if (H5F__get_mpi_atomicity(f, opt_args->get_mpi_atomicity.flag) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "cannot get MPI atomicity");
+
break;
}
/* H5Fset_mpi_atomicity */
case H5VL_NATIVE_FILE_SET_MPI_ATOMICITY: {
- hbool_t flag = (hbool_t)HDva_arg(arguments, int);
- if (H5F_set_mpi_atomicity(f, flag) < 0)
+ if (H5F__set_mpi_atomicity(f, opt_args->set_mpi_atomicity.flag) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "cannot set MPI atomicity");
+
break;
}
#endif /* H5_HAVE_PARALLEL */
@@ -792,7 +719,7 @@ H5VL__native_file_optional(void *obj, H5VL_file_optional_t optional_type, hid_t
/* Finalize H5Fopen */
case H5VL_NATIVE_FILE_POST_OPEN: {
/* Call package routine */
- if (H5F__post_open((H5F_t *)obj) < 0)
+ if (H5F__post_open(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't finish opening file")
break;
}
@@ -843,7 +770,7 @@ H5VL__native_file_close(void *file, hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_U
HGOTO_ERROR(H5E_ID, H5E_CANTGET, FAIL, "can't get ID ref count")
if (nref == 1)
if (H5F__flush(f) < 0)
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush cache")
} /* end if */
/* Close the file */