summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt47
-rw-r--r--src/H5.c253
-rw-r--r--src/H5A.c355
-rw-r--r--src/H5ACprivate.h34
-rw-r--r--src/H5Adeprec.c35
-rw-r--r--src/H5Aint.c40
-rw-r--r--src/H5Amodule.h24
-rw-r--r--src/H5Apkg.h16
-rw-r--r--src/H5Apublic.h267
-rw-r--r--src/H5B2int.c33
-rw-r--r--src/H5B2pkg.h12
-rw-r--r--src/H5CS.c14
-rw-r--r--src/H5CX.c453
-rw-r--r--src/H5D.c391
-rw-r--r--src/H5Dchunk.c126
-rw-r--r--src/H5Ddeprec.c31
-rw-r--r--src/H5Dint.c27
-rw-r--r--src/H5Dio.c91
-rw-r--r--src/H5Dmodule.h8
-rw-r--r--src/H5Dpkg.h4
-rw-r--r--src/H5Dpublic.h567
-rw-r--r--src/H5Dvirtual.c2
-rw-r--r--src/H5E.c35
-rw-r--r--src/H5ES.c407
-rw-r--r--src/H5ESdevelop.h50
-rw-r--r--src/H5ESevent.c16
-rw-r--r--src/H5ESint.c434
-rw-r--r--src/H5ESmodule.h6
-rw-r--r--src/H5ESpkg.h18
-rw-r--r--src/H5ESprivate.h5
-rw-r--r--src/H5ESpublic.h70
-rw-r--r--src/H5Eint.c22
-rw-r--r--src/H5Emodule.h75
-rw-r--r--src/H5Epublic.h36
-rw-r--r--src/H5F.c794
-rw-r--r--src/H5FDfamily.c8
-rw-r--r--src/H5FDhdfs.c18
-rw-r--r--src/H5FDhdfs.h15
-rw-r--r--src/H5FDlog.c2
-rw-r--r--src/H5FDmirror.c4
-rw-r--r--src/H5FDmulti.c8
-rw-r--r--src/H5FDprivate.h2
-rw-r--r--src/H5FDros3.c2
-rw-r--r--src/H5FDsplitter.c22
-rw-r--r--src/H5FDtest.c2
-rw-r--r--src/H5FDvfd_swmr.c4
-rw-r--r--src/H5FL.c56
-rw-r--r--src/H5Faccum.c2
-rw-r--r--src/H5Fdeprec.c53
-rw-r--r--src/H5Fefc.c8
-rw-r--r--src/H5Fint.c149
-rw-r--r--src/H5Fmodule.h19
-rw-r--r--src/H5Fmount.c25
-rw-r--r--src/H5Fmpi.c45
-rw-r--r--src/H5Fpkg.h144
-rw-r--r--src/H5Fprivate.h341
-rw-r--r--src/H5Fpublic.h47
-rw-r--r--src/H5Ftest.c26
-rw-r--r--src/H5Fvfd_swmr.c777
-rw-r--r--src/H5G.c83
-rw-r--r--src/H5Gcompact.c18
-rw-r--r--src/H5Gdense.c39
-rw-r--r--src/H5Gdeprec.c291
-rw-r--r--src/H5Gloc.c62
-rw-r--r--src/H5Gmodule.h25
-rw-r--r--src/H5Gname.c55
-rw-r--r--src/H5Gobj.c21
-rw-r--r--src/H5Gpkg.h79
-rw-r--r--src/H5Gprivate.h73
-rw-r--r--src/H5Gpublic.h2
-rw-r--r--src/H5Gstab.c26
-rw-r--r--src/H5Gtest.c6
-rw-r--r--src/H5HF.c19
-rw-r--r--src/H5HFcache.c12
-rw-r--r--src/H5HFman.c10
-rw-r--r--src/H5HGprivate.h2
-rw-r--r--src/H5I.c20
-rw-r--r--src/H5Idbg.c4
-rw-r--r--src/H5Iint.c36
-rw-r--r--src/H5Imodule.h81
-rw-r--r--src/H5Ipublic.h33
-rw-r--r--src/H5Itest.c10
-rw-r--r--src/H5L.c425
-rw-r--r--src/H5Ldeprec.c146
-rw-r--r--src/H5Lexternal.c14
-rw-r--r--src/H5Lint.c69
-rw-r--r--src/H5Lmodule.h25
-rw-r--r--src/H5Lpkg.h43
-rw-r--r--src/H5Lprivate.h44
-rw-r--r--src/H5Lpublic.h2
-rw-r--r--src/H5M.c348
-rw-r--r--src/H5MF.c22
-rw-r--r--src/H5MFprivate.h3
-rw-r--r--src/H5Mmodule.h6
-rw-r--r--src/H5Mprivate.h7
-rw-r--r--src/H5Mpublic.h112
-rw-r--r--src/H5O.c443
-rw-r--r--src/H5Ocache.c21
-rw-r--r--src/H5Odeprec.c155
-rw-r--r--src/H5Oflush.c29
-rw-r--r--src/H5Ofsinfo.c15
-rw-r--r--src/H5Omodule.h41
-rw-r--r--src/H5Opkg.h5
-rw-r--r--src/H5Oprivate.h10
-rw-r--r--src/H5Opublic.h679
-rw-r--r--src/H5PB.c2
-rw-r--r--src/H5PL.c2
-rw-r--r--src/H5PLint.c6
-rw-r--r--src/H5PLmodule.h30
-rw-r--r--src/H5PLplugin_cache.c84
-rw-r--r--src/H5Pdapl.c4
-rw-r--r--src/H5Pdxpl.c8
-rw-r--r--src/H5Pencdec.c2
-rw-r--r--src/H5Pfapl.c132
-rw-r--r--src/H5Pint.c3
-rw-r--r--src/H5Plapl.c2
-rw-r--r--src/H5Pmodule.h164
-rw-r--r--src/H5Pocpl.c4
-rw-r--r--src/H5Ppublic.h150
-rw-r--r--src/H5R.c199
-rw-r--r--src/H5RS.c22
-rw-r--r--src/H5RSprivate.h2
-rw-r--r--src/H5Rdeprec.c133
-rw-r--r--src/H5Rint.c29
-rw-r--r--src/H5Rmodule.h29
-rw-r--r--src/H5Rpkg.h2
-rw-r--r--src/H5Rpublic.h10
-rw-r--r--src/H5SL.c670
-rw-r--r--src/H5SLprivate.h4
-rw-r--r--src/H5SM.c2
-rw-r--r--src/H5Smodule.h45
-rw-r--r--src/H5Spublic.h112
-rw-r--r--src/H5T.c237
-rw-r--r--src/H5Tcommit.c119
-rw-r--r--src/H5Tconv.c128
-rw-r--r--src/H5Tmodule.h36
-rw-r--r--src/H5Tnative.c23
-rw-r--r--src/H5Tpkg.h6
-rw-r--r--src/H5Tprivate.h7
-rw-r--r--src/H5Tpublic.h4
-rw-r--r--src/H5Tref.c149
-rw-r--r--src/H5Tvlen.c50
-rw-r--r--src/H5VL.c213
-rw-r--r--src/H5VLcallback.c1712
-rw-r--r--src/H5VLconnector.h883
-rw-r--r--src/H5VLconnector_passthru.h101
-rw-r--r--src/H5VLdyn_ops.c334
-rw-r--r--src/H5VLint.c270
-rw-r--r--src/H5VLmodule.h8
-rw-r--r--src/H5VLnative.c45
-rw-r--r--src/H5VLnative.h387
-rw-r--r--src/H5VLnative_attr.c213
-rw-r--r--src/H5VLnative_blob.c34
-rw-r--r--src/H5VLnative_dataset.c240
-rw-r--r--src/H5VLnative_datatype.c46
-rw-r--r--src/H5VLnative_file.c365
-rw-r--r--src/H5VLnative_group.c129
-rw-r--r--src/H5VLnative_introspect.c5
-rw-r--r--src/H5VLnative_link.c135
-rw-r--r--src/H5VLnative_object.c174
-rw-r--r--src/H5VLnative_private.h72
-rw-r--r--src/H5VLpassthru.c682
-rw-r--r--src/H5VLpkg.h12
-rw-r--r--src/H5VLprivate.h116
-rw-r--r--src/H5VLpublic.h21
-rw-r--r--src/H5VLtest.c96
-rw-r--r--src/H5Zmodule.h109
-rw-r--r--src/H5Zscaleoffset.c66
-rw-r--r--src/H5Ztrans.c82
-rw-r--r--src/H5detect.c14
-rw-r--r--src/H5module.h27
-rw-r--r--src/H5mpi.c2
-rw-r--r--src/H5private.h56
-rw-r--r--src/H5public.h42
-rw-r--r--src/H5system.c28
-rw-r--r--src/H5trace.c88
-rw-r--r--src/H5win32defs.h2
-rw-r--r--src/Makefile.am6
-rw-r--r--src/hdf5.h2
-rw-r--r--src/libhdf5.settings.in51
-rw-r--r--src/uthash.h30
181 files changed, 12198 insertions, 7559 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index a055271..33d31fb 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -180,6 +180,7 @@ set (H5ES_SOURCES
${HDF5_SRC_DIR}/H5ESlist.c
)
set (H5ES_HDRS
+ ${HDF5_SRC_DIR}/H5ESdevelop.h
${HDF5_SRC_DIR}/H5ESpublic.h
)
IDE_GENERATED_PROPERTIES ("H5ES" "${H5ES_HDRS}" "${H5ES_SOURCES}" )
@@ -669,6 +670,7 @@ IDE_GENERATED_PROPERTIES ("H5UC" "${H5UC_HDRS}" "${H5UC_SOURCES}" )
set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VL.c
${HDF5_SRC_DIR}/H5VLcallback.c
+ ${HDF5_SRC_DIR}/H5VLdyn_ops.c
${HDF5_SRC_DIR}/H5VLint.c
${HDF5_SRC_DIR}/H5VLnative.c
${HDF5_SRC_DIR}/H5VLnative_attr.c
@@ -682,6 +684,7 @@ set (H5VL_SOURCES
${HDF5_SRC_DIR}/H5VLnative_object.c
${HDF5_SRC_DIR}/H5VLnative_token.c
${HDF5_SRC_DIR}/H5VLpassthru.c
+ ${HDF5_SRC_DIR}/H5VLtest.c
)
set (H5VL_HDRS
${HDF5_SRC_DIR}/H5VLconnector.h
@@ -1415,36 +1418,6 @@ endif ()
# Option to build documentation
#-----------------------------------------------------------------------------
if (DOXYGEN_FOUND)
- set (DOXYGEN_PACKAGE ${HDF5_PACKAGE_NAME})
- set (DOXYGEN_VERSION_STRING ${HDF5_PACKAGE_VERSION_STRING})
- set (DOXYGEN_INCLUDE_ALIASES_PATH ${HDF5_DOXYGEN_DIR})
- set (DOXYGEN_INCLUDE_ALIASES aliases)
- set (DOXYGEN_VERBATIM_VARS DOXYGEN_INCLUDE_ALIASES)
- set (DOXYGEN_PROJECT_LOGO ${HDF5_DOXYGEN_DIR}/img/HDFG-logo.png)
- set (DOXYGEN_PROJECT_BRIEF "C-API Reference")
- set (DOXYGEN_INPUT_DIRECTORY "${HDF5_SRC_DIR} ${HDF5_DOXYGEN_DIR}/dox ${HDF5_GENERATED_SOURCE_DIR}")
- set (DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
- set (DOXYGEN_MACRO_EXPANSION YES)
- set (DOXYGEN_OUTPUT_DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs)
- set (DOXYGEN_EXAMPLES_DIRECTORY "${HDF5_DOXYGEN_DIR}/examples ${HDF5_SRC_DIR} ${HDF5_SOURCE_DIR}/examples ${HDF5_TEST_SRC_DIR}")
- set (DOXYGEN_LAYOUT_FILE ${HDF5_DOXYGEN_DIR}/hdf5doxy_layout.xml)
- set (DOXYGEN_HTML_HEADER ${HDF5_DOXYGEN_DIR}/hdf5_header.html)
- set (DOXYGEN_HTML_FOOTER ${HDF5_DOXYGEN_DIR}/hdf5_footer.html)
- set (DOXYGEN_HTML_EXTRA_STYLESHEET ${HDF5_DOXYGEN_DIR}/hdf5doxy.css)
- set (DOXYGEN_HTML_EXTRA_FILES "${HDF5_DOXYGEN_DIR}/hdf5_navtree_hacks.js ${HDF5_DOXYGEN_DIR}/img/ftv2node.png ${HDF5_DOXYGEN_DIR}/img/ftv2pnode.png")
- set (DOXYGEN_SERVER_BASED_SEARCH NO)
- set (DOXYGEN_EXTERNAL_SEARCH NO)
- set (DOXYGEN_SEARCHENGINE_URL)
-
-# This configure and custom target work together
- # Replace variables inside @@ with the current values
- configure_file (${HDF5_DOXYGEN_DIR}/Doxyfile.in ${HDF5_BINARY_DIR}/Doxyfile @ONLY)
- add_custom_target (hdf5lib_doc ALL
- COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile
- DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
- WORKING_DIRECTORY ${HDF5_SRC_DIR}
- COMMENT "Generating HDF5 library Source API documentation with Doxygen"
- VERBATIM )
# This cmake function requires that the non-default doxyfile settings are provided with set (DOXYGEN_xxx) commands
# In addition the doxyfile aliases @INCLUDE option is not supported and would need to be provided in a set (DOXYGEN_ALIASES) command.
# doxygen_add_docs (hdf5lib_doc
@@ -1454,11 +1427,15 @@ if (DOXYGEN_FOUND)
# WORKING_DIRECTORY ${HDF5_SRC_DIR}
# COMMENT "Generating HDF5 library Source Documentation"
# )
- install (
- DIRECTORY ${HDF5_BINARY_DIR}/hdf5lib_docs/html
- DESTINATION ${HDF5_INSTALL_DATA_DIR}
- COMPONENT Documents
- )
+
+# This custom target and doxygen/configure work together
+ # Replace variables inside @@ with the current values
+ add_custom_target (hdf5lib_doc ALL
+ COMMAND ${DOXYGEN_EXECUTABLE} ${HDF5_BINARY_DIR}/Doxyfile
+ DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_SRC_BINARY_DIR}/H5lib_settings.c
+ WORKING_DIRECTORY ${HDF5_SRC_DIR}
+ COMMENT "Generating HDF5 library Source API documentation with Doxygen"
+ VERBATIM )
if (NOT TARGET doxygen)
add_custom_target (doxygen)
diff --git a/src/H5.c b/src/H5.c
index 3454786..69c81ea 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -70,6 +70,10 @@ hbool_t H5_PKG_INIT_VAR = FALSE;
/* Library Private Variables */
/*****************************/
+/* Library incompatible release versions */
+const unsigned VERS_RELEASE_EXCEPTIONS[] = {0};
+const unsigned VERS_RELEASE_EXCEPTIONS_SIZE = 0;
+
/* statically initialize block for pthread_once call used in initializing */
/* the first global mutex */
#ifdef H5_HAVE_THREADSAFE
@@ -285,13 +289,13 @@ done:
} /* end H5_init_library() */
/*-------------------------------------------------------------------------
- * Function: H5_term_library
+ * Function: H5_term_library
*
- * Purpose: Terminate interfaces in a well-defined order due to
- * dependencies among the interfaces, then terminate
- * library-specific data.
+ * Purpose: Terminate interfaces in a well-defined order due to
+ * dependencies among the interfaces, then terminate
+ * library-specific data.
*
- * Return: void
+ * Return: void
*
*-------------------------------------------------------------------------
*/
@@ -509,22 +513,22 @@ done:
} /* end H5_term_library() */
/*-------------------------------------------------------------------------
- * Function: H5dont_atexit
+ * Function: H5dont_atexit
*
- * Purpose: Indicates that the library is not to clean up after itself
- * when the application exits by calling exit() or returning
- * from main(). This function must be called before any other
- * HDF5 function or constant is used or it will have no effect.
+ * Purpose: Indicates that the library is not to clean up after itself
+ * when the application exits by calling exit() or returning
+ * from main(). This function must be called before any other
+ * HDF5 function or constant is used or it will have no effect.
*
- * If this function is used then certain memory buffers will not
- * be de-allocated nor will open files be flushed automatically.
- * The application may still call H5close() explicitly to
- * accomplish these things.
+ * If this function is used then certain memory buffers will not
+ * be de-allocated nor will open files be flushed automatically.
+ * The application may still call H5close() explicitly to
+ * accomplish these things.
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative if this function is called more than
- * once or if it is called too late.
+ * Failure: negative if this function is called more than
+ * once or if it is called too late.
*
*-------------------------------------------------------------------------
*/
@@ -545,19 +549,19 @@ H5dont_atexit(void)
} /* end H5dont_atexit() */
/*-------------------------------------------------------------------------
- * Function: H5garbage_collect
+ * Function: H5garbage_collect
*
- * Purpose: Walks through all the garbage collection routines for the
- * library, which are supposed to free any unused memory they have
- * allocated.
+ * Purpose: Walks through all the garbage collection routines for the
+ * library, which are supposed to free any unused memory they have
+ * allocated.
*
* These should probably be registered dynamically in a linked list of
* functions to call, but there aren't that many right now, so we
* hard-wire them...
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
*-------------------------------------------------------------------------
*/
@@ -578,9 +582,9 @@ done:
} /* end H5garbage_collect() */
/*-------------------------------------------------------------------------
- * Function: H5set_free_list_limits
+ * Function: H5set_free_list_limits
*
- * Purpose: Sets limits on the different kinds of free lists. Setting a value
+ * Purpose: Sets limits on the different kinds of free lists. Setting a value
* of -1 for a limit means no limit of that type. These limits are global
* for the entire library. Each "global" limit only applies to free lists
* of that type, so if an application sets a limit of 1 MB on each of the
@@ -598,9 +602,9 @@ done:
* int blk_global_lim; IN: The limit on all "block" free list memory used
* int blk_list_lim; IN: The limit on memory used in each "block" free list
*
- * Return: Success: non-negative
+ * Return: Success: non-negative
*
- * Failure: negative
+ * Failure: negative
*
*-------------------------------------------------------------------------
*/
@@ -624,11 +628,11 @@ done:
} /* end H5set_free_list_limits() */
/*-------------------------------------------------------------------------
- * Function: H5get_free_list_sizes
+ * Function: H5get_free_list_sizes
*
- * Purpose: Gets the current size of the different kinds of free lists that
- * the library uses to manage memory. The free list sizes can be set with
- * H5set_free_list_limits and garbage collected with H5garbage_collect.
+ * Purpose: Gets the current size of the different kinds of free lists that
+ * the library uses to manage memory. The free list sizes can be set with
+ * H5set_free_list_limits and garbage collected with H5garbage_collect.
* These lists are global for the entire library.
*
* Parameters:
@@ -637,8 +641,8 @@ done:
* size_t *blk_size; OUT: The current size of all "block" free list memory used
* size_t *fac_size; OUT: The current size of all "factory" free list memory used
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
* Programmer: Quincey Koziol
* Friday, March 6, 2020
@@ -663,23 +667,23 @@ done:
} /* end H5get_free_list_sizes() */
/*-------------------------------------------------------------------------
- * Function: H5get_alloc_stats
+ * Function: H5get_alloc_stats
*
- * Purpose: Gets the memory allocation statistics for the library, if the
- * --enable-memory-alloc-sanity-check option was given when building the
+ * Purpose: Gets the memory allocation statistics for the library, if the
+ * --enable-memory-alloc-sanity-check option was given when building the
* library. Applications can check whether this option was enabled by
- * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This
- * option is enabled by default for debug builds of the library and
- * disabled by default for non-debug builds. If the option is not enabled,
- * all the values returned with be 0. These statistics are global for the
- * entire library, but don't include allocations from chunked dataset I/O
- * filters or non-native VOL connectors.
+ * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This
+ * option is enabled by default for debug builds of the library and
+ * disabled by default for non-debug builds. If the option is not enabled,
+ * all the values returned with be 0. These statistics are global for the
+ * entire library, but don't include allocations from chunked dataset I/O
+ * filters or non-native VOL connectors.
*
* Parameters:
* H5_alloc_stats_t *stats; OUT: Memory allocation statistics
*
- * Return: Success: non-negative
- * Failure: negative
+ * Return: Success: non-negative
+ * Failure: negative
*
* Programmer: Quincey Koziol
* Saturday, March 7, 2020
@@ -812,12 +816,12 @@ H5__debug_mask(const char *s)
#ifdef H5_HAVE_PARALLEL
/*-------------------------------------------------------------------------
- * Function: H5__mpi_delete_cb
+ * Function: H5__mpi_delete_cb
*
- * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5
+ * Purpose: Callback attribute on MPI_COMM_SELF to terminate the HDF5
* library when the communicator is destroyed, i.e. on MPI_Finalize.
*
- * Return: MPI_SUCCESS
+ * Return: MPI_SUCCESS
*
*-------------------------------------------------------------------------
*/
@@ -831,18 +835,18 @@ H5__mpi_delete_cb(MPI_Comm H5_ATTR_UNUSED comm, int H5_ATTR_UNUSED keyval, void
#endif /*H5_HAVE_PARALLEL*/
/*-------------------------------------------------------------------------
- * Function: H5get_libversion
+ * Function: H5get_libversion
*
- * Purpose: Returns the library version numbers through arguments. MAJNUM
- * will be the major revision number of the library, MINNUM the
- * minor revision number, and RELNUM the release revision number.
+ * Purpose: Returns the library version numbers through arguments. MAJNUM
+ * will be the major revision number of the library, MINNUM the
+ * minor revision number, and RELNUM the release revision number.
*
- * Note: When printing an HDF5 version number it should be printed as
+ * Note: When printing an HDF5 version number it should be printed as
*
- * printf("%u.%u.%u", maj, min, rel) or
- * printf("version %u.%u release %u", maj, min, rel)
+ * printf("%u.%u.%u", maj, min, rel) or
+ * printf("version %u.%u release %u", maj, min, rel)
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -867,17 +871,20 @@ done:
} /* end H5get_libversion() */
/*-------------------------------------------------------------------------
- * Function: H5check_version
+ * Function: H5check_version
*
- * Purpose: Verifies that the arguments match the version numbers
- * compiled into the library. This function is intended to be
- * called from user to verify that the versions of header files
- * compiled into the application match the version of the hdf5
- * library.
+ * Purpose: Verifies that the arguments match the version numbers
+ * compiled into the library. This function is intended to be
+ * called from user to verify that the versions of header files
+ * compiled into the application match the version of the hdf5
+ * library.
+ * Within major.minor.release version, the expectation
+ * is that all release versions are compatible, exceptions to
+ * this rule must be added to the VERS_RELEASE_EXCEPTIONS list.
*
- * Return: Success: SUCCEED
+ * Return: Success: SUCCEED
*
- * Failure: abort()
+ * Failure: abort()
*
*-------------------------------------------------------------------------
*/
@@ -890,6 +897,15 @@ done:
"linked with a different version of static or shared HDF5 library.\n" \
"You should recompile the application or check your shared library related\n" \
"settings such as 'LD_LIBRARY_PATH'.\n"
+#define RELEASE_MISMATCH_WARNING \
+ "Warning! ***HDF5 library release mismatched error***\n" \
+ "The HDF5 header files used to compile this application are not compatible with\n" \
+ "the version used by the HDF5 library to which this application is linked.\n" \
+ "Data corruption or segmentation faults may occur if the application continues.\n" \
+ "This can happen when an application was compiled by one version of HDF5 but\n" \
+ "linked with an incompatible version of static or shared HDF5 library.\n" \
+ "You should recompile the application or check your shared library related\n" \
+ "settings such as 'LD_LIBRARY_PATH'.\n"
herr_t
H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
@@ -918,7 +934,11 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
disable_version_check = (unsigned int)HDstrtol(s, NULL, 0);
}
- if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE != relnum) {
+ /* H5_VERS_MAJOR and H5_VERS_MINOR must match */
+ /* Cast relnum to int to avoid warning for unsigned < 0 comparison
+ * in first release versions */
+ if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > (int)relnum) {
+
switch (disable_version_check) {
case 0:
HDfprintf(stderr, "%s%s", version_mismatch_warning,
@@ -953,7 +973,51 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
break;
} /* end switch */
- } /* end if */
+ } /* end if (H5_VERS_MAJOR != majnum || H5_VERS_MINOR != minnum || H5_VERS_RELEASE > relnum) */
+
+ /* H5_VERS_RELEASE should be compatible, we will only add checks for exceptions */
+ if (H5_VERS_RELEASE != relnum) {
+ for (unsigned i = 0; i < VERS_RELEASE_EXCEPTIONS_SIZE; i++) {
+ /* Check for incompatible headers or incompatible library */
+ if (VERS_RELEASE_EXCEPTIONS[i] == relnum || VERS_RELEASE_EXCEPTIONS[i] == H5_VERS_RELEASE) {
+ switch (disable_version_check) {
+ case 0:
+ HDfprintf(
+ stderr, "%s%s", version_mismatch_warning,
+ "You can, at your own risk, disable this warning by setting the environment\n"
+ "variable 'HDF5_DISABLE_VERSION_CHECK' to a value of '1'.\n"
+ "Setting it to 2 or higher will suppress the warning messages totally.\n");
+ /* Mention the versions we are referring to */
+ HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum,
+ relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR,
+ (unsigned)H5_VERS_RELEASE);
+
+ /* Bail out now. */
+ HDfputs("Bye...\n", stderr);
+ HDabort();
+ case 1:
+ /* continue with a warning */
+ /* Note that the warning message is embedded in the format string.*/
+ HDfprintf(stderr,
+ "%s'HDF5_DISABLE_VERSION_CHECK' "
+ "environment variable is set to %d, application will\n"
+ "continue at your own risk.\n",
+ version_mismatch_warning, disable_version_check);
+ /* Mention the versions we are referring to */
+ HDfprintf(stderr, "Headers are %u.%u.%u, library is %u.%u.%u\n", majnum, minnum,
+ relnum, (unsigned)H5_VERS_MAJOR, (unsigned)H5_VERS_MINOR,
+ (unsigned)H5_VERS_RELEASE);
+ break;
+ default:
+ /* 2 or higher: continue silently */
+ break;
+ } /* end switch */
+
+ } /* end if */
+
+ } /* end for */
+
+ } /* end if (H5_VERS_RELEASE != relnum) */
/* Indicate that the version check has been performed */
checked = 1;
@@ -964,12 +1028,9 @@ H5check_version(unsigned majnum, unsigned minnum, unsigned relnum)
* Check only the first sizeof(lib_str) char. Assume the information
* will fit within this size or enough significance.
*/
- HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d", H5_VERS_MAJOR, H5_VERS_MINOR,
- H5_VERS_RELEASE);
- if (*substr) {
- HDstrncat(lib_str, "-", (size_t)1);
- HDstrncat(lib_str, substr, (sizeof(lib_str) - HDstrlen(lib_str)) - 1);
- } /* end if */
+ HDsnprintf(lib_str, sizeof(lib_str), "HDF5 library version: %d.%d.%d%s%s", H5_VERS_MAJOR,
+ H5_VERS_MINOR, H5_VERS_RELEASE, (*substr ? "-" : ""), substr);
+
if (HDstrcmp(lib_str, H5_lib_vers_info_g) != 0) {
HDfputs("Warning! Library version information error.\n"
"The HDF5 library version information are not "
@@ -998,7 +1059,7 @@ done:
* is failing inexplicably, then try calling this function
* first.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1017,12 +1078,12 @@ done:
} /* end H5open() */
/*-------------------------------------------------------------------------
- * Function: H5atclose
+ * Function: H5atclose
*
- * Purpose: Register a callback for the library to invoke when it's
- * closing. Callbacks are invoked in LIFO order.
+ * Purpose: Register a callback for the library to invoke when it's
+ * closing. Callbacks are invoked in LIFO order.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1056,11 +1117,11 @@ done:
} /* end H5atclose() */
/*-------------------------------------------------------------------------
- * Function: H5close
+ * Function: H5close
*
- * Purpose: Terminate the library and release all resources.
+ * Purpose: Terminate the library and release all resources.
*
- * Return: Non-negative on success/Negative on failure
+ * Return: Non-negative on success/Negative on failure
*
*-------------------------------------------------------------------------
*/
@@ -1081,9 +1142,9 @@ H5close(void)
} /* end H5close() */
/*-------------------------------------------------------------------------
- * Function: H5allocate_memory
+ * Function: H5allocate_memory
*
- * Purpose: Allocate a memory buffer with the semantics of malloc().
+ * Purpose: Allocate a memory buffer with the semantics of malloc().
*
* NOTE: This function is intended for use with filter
* plugins so that all allocation and free operations
@@ -1121,9 +1182,9 @@ H5allocate_memory(size_t size, hbool_t clear)
} /* end H5allocate_memory() */
/*-------------------------------------------------------------------------
- * Function: H5resize_memory
+ * Function: H5resize_memory
*
- * Purpose: Resize a memory buffer with the semantics of realloc().
+ * Purpose: Resize a memory buffer with the semantics of realloc().
*
* NOTE: This function is intended for use with filter
* plugins so that all allocation and free operations
@@ -1158,14 +1219,14 @@ H5resize_memory(void *mem, size_t size)
} /* end H5resize_memory() */
/*-------------------------------------------------------------------------
- * Function: H5free_memory
+ * Function: H5free_memory
*
- * Purpose: Frees memory allocated by the library that it is the user's
+ * Purpose: Frees memory allocated by the library that it is the user's
* responsibility to free. Ensures that the same library
* that was used to allocate the memory frees it. Passing
* NULL pointers is allowed.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1182,12 +1243,12 @@ H5free_memory(void *mem)
} /* end H5free_memory() */
/*-------------------------------------------------------------------------
- * Function: H5is_library_threadsafe
+ * Function: H5is_library_threadsafe
*
- * Purpose: Checks to see if the library was built with thread-safety
+ * Purpose: Checks to see if the library was built with thread-safety
* enabled.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
@@ -1213,16 +1274,16 @@ H5is_library_threadsafe(hbool_t *is_ts /*out*/)
} /* end H5is_library_threadsafe() */
/*-------------------------------------------------------------------------
- * Function: H5is_library_terminating
+ * Function: H5is_library_terminating
*
- * Purpose: Checks to see if the library is shutting down.
+ * Purpose: Checks to see if the library is shutting down.
*
- * Note: Useful for plugins to detect when the library is terminating.
- * For example, a VOL connector could check if a "file close"
- * callback was the result of the library shutdown process, or
- * an API action from the application.
+ * Note: Useful for plugins to detect when the library is terminating.
+ * For example, a VOL connector could check if a "file close"
+ * callback was the result of the library shutdown process, or
+ * an API action from the application.
*
- * Return: SUCCEED/FAIL
+ * Return: SUCCEED/FAIL
*
*-------------------------------------------------------------------------
*/
diff --git a/src/H5A.c b/src/H5A.c
index 4c1f5f1..c986d1f 100644
--- a/src/H5A.c
+++ b/src/H5A.c
@@ -320,7 +320,7 @@ H5A__create_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Verify access property list and set up collective metadata if appropriate */
@@ -630,7 +630,7 @@ H5A__open_by_name_api_common(hid_t loc_id, const char *obj_name, const char *att
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Verify access property list and set up collective metadata if appropriate */
@@ -764,8 +764,8 @@ H5A__open_by_idx_api_common(hid_t loc_id, const char *obj_name, H5_index_t idx_t
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "invalid iteration order specified")
/* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, obj_name, idx_type, order, n, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr,
- &loc_params) < 0)
+ if (H5VL_setup_idx_args(loc_id, obj_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr, &loc_params) <
+ 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Verify access property list and set up collective metadata if appropriate */
@@ -1057,7 +1057,7 @@ done:
*--------------------------------------------------------------------------*/
herr_t
H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id, hid_t dtype_id,
- void *buf, hid_t es_id)
+ void *buf /*out*/, hid_t es_id)
{
H5VL_object_t *vol_obj = NULL; /* Object for attr_id */
void * token = NULL; /* Request token for async operation */
@@ -1065,7 +1065,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
- H5TRACE7("e", "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id);
+ H5TRACE7("e", "*s*sIuiixi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id);
/* Set up request token pointer for asynchronous operation */
if (H5ES_NONE != es_id)
@@ -1079,7 +1079,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid
if (NULL != token)
/* clang-format off */
if (H5ES_insert(es_id, vol_obj->connector, token,
- H5ARG_TRACE7(__func__, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0)
+ H5ARG_TRACE7(__func__, "*s*sIuiixi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0)
/* clang-format on */
HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set")
@@ -1106,8 +1106,9 @@ done:
hid_t
H5Aget_space(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_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", attr_id);
@@ -1116,11 +1117,17 @@ H5Aget_space(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_SPACE;
+ vol_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get the dataspace */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) <
- 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace of attribute")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_space.space_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_space() */
@@ -1144,8 +1151,9 @@ done:
hid_t
H5Aget_type(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_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", attr_id);
@@ -1154,10 +1162,17 @@ H5Aget_type(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_TYPE;
+ vol_cb_args.args.get_type.type_id = H5I_INVALID_HID;
+
/* Get the datatype */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype of attribute")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_type.type_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_type() */
@@ -1184,8 +1199,9 @@ done:
hid_t
H5Aget_create_plist(hid_t attr_id)
{
- H5VL_object_t *vol_obj = NULL; /* Attribute object for ID */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_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", attr_id);
@@ -1196,11 +1212,18 @@ H5Aget_create_plist(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_ACPL;
+ vol_cb_args.args.get_acpl.acpl_id = H5I_INVALID_HID;
+
/* Get the acpl */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_ACPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, H5I_INVALID_HID,
"unable to get creation property list for attribute")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_acpl.acpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_create_plist() */
@@ -1229,9 +1252,10 @@ done:
ssize_t
H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/)
{
- H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1;
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t attr_name_len = 0; /* Length of attribute name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "izx", attr_id, buf_size, buf);
@@ -1242,15 +1266,21 @@ H5Aget_name(hid_t attr_id, size_t buf_size, char *buf /*out*/)
if (!buf && buf_size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "buf cannot be NULL if buf_size is non-zero")
- /* Set location struct parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(attr_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_NAME;
+ vol_cb_args.args.get_name.loc_params.type = H5VL_OBJECT_BY_SELF;
+ vol_cb_args.args.get_name.loc_params.obj_type = H5I_get_type(attr_id);
+ vol_cb_args.args.get_name.buf_size = buf_size;
+ vol_cb_args.args.get_name.buf = buf;
+ vol_cb_args.args.get_name.attr_name_len = &attr_name_len;
/* Get the attribute name */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- buf_size, buf, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute name")
+ /* Set the return value */
+ ret_value = (ssize_t)attr_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Aget_name() */
@@ -1276,9 +1306,10 @@ ssize_t
H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
char *name /*out*/, size_t size, hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- ssize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t attr_name_len = 0; /* Length of attribute name */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("Zs", "i*sIiIohxzi", loc_id, obj_name, idx_type, order, n, name, size, lapl_id);
@@ -1303,19 +1334,26 @@ H5Aget_name_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_name;
- loc_params.loc_data.loc_by_idx.idx_type = idx_type;
- loc_params.loc_data.loc_by_idx.order = order;
- loc_params.loc_data.loc_by_idx.n = n;
- loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_NAME;
+ vol_cb_args.args.get_name.loc_params.type = H5VL_OBJECT_BY_IDX;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.name = obj_name;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.idx_type = idx_type;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.order = order;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.n = n;
+ vol_cb_args.args.get_name.loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
+ vol_cb_args.args.get_name.loc_params.obj_type = H5I_get_type(loc_id);
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.attr_name_len = &attr_name_len;
/* Get the name */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- size, name, &ret_value) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get name")
+ /* Set the return value */
+ ret_value = (ssize_t)attr_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Aget_name_by_idx() */
@@ -1340,8 +1378,10 @@ done:
hsize_t
H5Aget_storage_size(hid_t attr_id)
{
- H5VL_object_t *vol_obj;
- hsize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hsize_t storage_size = 0; /* Storage size of attribute */
+ hsize_t ret_value; /* Return value */
FUNC_ENTER_API(0)
H5TRACE1("h", "i", attr_id);
@@ -1350,10 +1390,16 @@ H5Aget_storage_size(hid_t attr_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(attr_id, H5I_ATTR)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, 0, "not an attribute")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_STORAGE_SIZE;
+ vol_cb_args.args.get_storage_size.data_size = &storage_size;
+
/* Get the storage size */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_STORAGE_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get acpl")
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, 0, "unable to get storage size")
+
+ /* Set the return value */
+ ret_value = storage_size;
done:
FUNC_LEAVE_API(ret_value)
@@ -1375,9 +1421,9 @@ done:
herr_t
H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", attr_id, ainfo);
@@ -1388,12 +1434,15 @@ H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/)
if (!ainfo)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "attribute_info parameter cannot be NULL")
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(attr_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_INFO;
+ vol_cb_args.args.get_info.loc_params.type = H5VL_OBJECT_BY_SELF;
+ vol_cb_args.args.get_info.loc_params.obj_type = H5I_get_type(attr_id);
+ vol_cb_args.args.get_info.attr_name = NULL;
+ vol_cb_args.args.get_info.ainfo = ainfo;
/* Get the attribute information */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- ainfo) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1417,9 +1466,9 @@ herr_t
H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H5A_info_t *ainfo /*out*/,
hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*sxi", loc_id, obj_name, attr_name, ainfo, lapl_id);
@@ -1438,18 +1487,21 @@ H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.loc_data.loc_by_name.name = obj_name;
- loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_INFO;
+ vol_cb_args.args.get_info.loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_name.name = obj_name;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ vol_cb_args.args.get_info.loc_params.obj_type = H5I_get_type(loc_id);
+ vol_cb_args.args.get_info.attr_name = attr_name;
+ vol_cb_args.args.get_info.ainfo = ainfo;
+
/* Get the attribute information */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- ainfo, attr_name) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1474,9 +1526,9 @@ herr_t
H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
H5A_info_t *ainfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Attribute object for ID */
+ H5VL_attr_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, obj_name, idx_type, order, n, ainfo, lapl_id);
@@ -1497,21 +1549,24 @@ H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_name;
- loc_params.loc_data.loc_by_idx.idx_type = idx_type;
- loc_params.loc_data.loc_by_idx.order = order;
- loc_params.loc_data.loc_by_idx.n = n;
- loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_GET_INFO;
+ vol_cb_args.args.get_info.loc_params.type = H5VL_OBJECT_BY_IDX;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.name = obj_name;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.idx_type = idx_type;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.order = order;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.n = n;
+ vol_cb_args.args.get_info.loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
+ vol_cb_args.args.get_info.loc_params.obj_type = H5I_get_type(loc_id);
+ vol_cb_args.args.get_info.attr_name = NULL;
+ vol_cb_args.args.get_info.ainfo = ainfo;
+
/* Get the attribute information */
- if (H5VL_attr_get(vol_obj, H5VL_ATTR_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params,
- ainfo) < 0)
+ if (H5VL_attr_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
done:
@@ -1541,12 +1596,19 @@ H5A__rename_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const
HDassert(new_name);
/* Avoid thrashing things if the names are the same */
- if (HDstrcmp(old_name, new_name) != 0)
+ if (HDstrcmp(old_name, new_name) != 0) {
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_RENAME;
+ vol_cb_args.args.rename.old_name = old_name;
+ vol_cb_args.args.rename.new_name = new_name;
+
/* Rename the attribute */
- if (H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_RENAME, H5P_DATASET_XFER_DEFAULT, token_ptr,
- old_name, new_name) < 0)
+ if (H5VL_attr_specific(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute from '%s' to '%s'", old_name,
new_name)
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1700,7 +1762,7 @@ H5A__rename_by_name_api_common(hid_t loc_id, const char *obj_name, const char *o
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments")
/* Rename the attribute */
@@ -1830,14 +1892,15 @@ herr_t
H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx /*in,out */,
H5A_operator2_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIo*hAO*x", loc_id, idx_type, order, idx, op, op_data);
- /* check arguments */
+ /* Check arguments */
if (H5I_ATTR == H5I_get_type(loc_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "location is not valid for an attribute")
if (idx_type <= H5_INDEX_UNKNOWN || idx_type >= H5_INDEX_N)
@@ -1845,16 +1908,25 @@ H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *i
if (order <= H5_ITER_UNKNOWN || order >= H5_ITER_N)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
+ /* Get the loc object */
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set the location access parameters */
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the loc 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 */
+ vol_cb_args.op_type = H5VL_ATTR_ITER;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx = idx;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
/* Iterate over attributes */
- if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
@@ -1908,9 +1980,10 @@ herr_t
H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx /*in,out */, H5A_operator2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object location */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hAO*xi", loc_id, obj_name, idx_type, order, idx, op, op_data, lapl_id);
@@ -1929,18 +2002,27 @@ H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_i
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* get the loc object */
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set the location access parameters */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.obj_type = H5I_get_type(loc_id);
loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* get the loc 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 */
+ vol_cb_args.op_type = H5VL_ATTR_ITER;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx = idx;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
/* Iterate over attributes */
- if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, idx, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
done:
@@ -1964,9 +2046,10 @@ done:
herr_t
H5Adelete(hid_t loc_id, const char *name)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
@@ -1983,17 +2066,20 @@ H5Adelete(hid_t loc_id, const char *name)
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set collective metadata read")
- /* Fill in location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* Get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set the location access parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_DELETE;
+ vol_cb_args.args.del.name = name;
+
/* Delete the attribute */
- if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -2019,9 +2105,10 @@ done:
herr_t
H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*s*si", loc_id, obj_name, attr_name, lapl_id);
@@ -2038,19 +2125,22 @@ H5Adelete_by_name(hid_t loc_id, const char *obj_name, const char *attr_name, hid
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Fill in location struct fields */
+ /* Get the object */
+ if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ /* Set the location access parameters */
loc_params.type = H5VL_OBJECT_BY_NAME;
loc_params.loc_data.loc_by_name.name = obj_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* Get the object */
- if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_DELETE;
+ vol_cb_args.args.del.name = attr_name;
/* Delete the attribute */
- if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- attr_name) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -2085,9 +2175,10 @@ herr_t
H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
hid_t lapl_id)
{
- H5VL_object_t * vol_obj;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*sIiIohi", loc_id, obj_name, idx_type, order, n, lapl_id);
@@ -2106,21 +2197,24 @@ H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_ite
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params.type = H5VL_OBJECT_BY_IDX;
- loc_params.loc_data.loc_by_idx.name = obj_name;
- loc_params.loc_data.loc_by_idx.idx_type = idx_type;
- loc_params.loc_data.loc_by_idx.order = order;
- loc_params.loc_data.loc_by_idx.n = n;
- loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
- loc_params.obj_type = H5I_get_type(loc_id);
-
/* get the object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set the location access parameters */
+ loc_params.type = H5VL_OBJECT_BY_NAME;
+ loc_params.loc_data.loc_by_name.name = obj_name;
+ loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_DELETE_BY_IDX;
+ vol_cb_args.args.delete_by_idx.idx_type = idx_type;
+ vol_cb_args.args.delete_by_idx.order = order;
+ vol_cb_args.args.delete_by_idx.n = n;
+
/* Delete the attribute */
- if (H5VL_attr_specific(vol_obj, &loc_params, H5VL_ATTR_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- NULL) < 0)
+ if (H5VL_attr_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
done:
@@ -2233,7 +2327,8 @@ static herr_t
H5A__exists_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const char *attr_name,
hbool_t *attr_exists, void **token_ptr)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_attr_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -2245,9 +2340,13 @@ H5A__exists_common(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, const
if (!attr_name || !*attr_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no attribute name")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_ATTR_EXISTS;
+ vol_cb_args.args.exists.name = attr_name;
+ vol_cb_args.args.exists.exists = attr_exists;
+
/* Check if the attribute exists */
- if (H5VL_attr_specific(vol_obj, loc_params, H5VL_ATTR_EXISTS, H5P_DATASET_XFER_DEFAULT, token_ptr,
- attr_name, attr_exists) < 0)
+ if (H5VL_attr_specific(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
done:
@@ -2400,7 +2499,7 @@ H5A__exists_by_name_api_common(hid_t loc_id, const char *obj_name, const char *a
/* obj_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, obj_name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, obj_name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTSET, FAIL, "can't set object access arguments")
/* Check if the attribute exists */
diff --git a/src/H5ACprivate.h b/src/H5ACprivate.h
index 188f9ee..f7bed0c 100644
--- a/src/H5ACprivate.h
+++ b/src/H5ACprivate.h
@@ -234,27 +234,27 @@ typedef struct H5AC_proxy_entry_t {
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.3f, \
+ /* double min_clean_fraction = */ 0.3, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ (1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9f, \
- /* double increment = */ 2.0f, \
+ /* double lower_hr_threshold = */ 0.9, \
+ /* double increment = */ 2.0, \
/* hbool_t apply_max_increment = */ TRUE, \
/* size_t max_increment = */ (4 * 1024 * 1024), \
/* enum H5C_cache_flash_incr_mode */ \
/* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.0f, \
- /* double flash_threshold = */ 0.25f, \
+ /* double flash_multiple = */ 1.0, \
+ /* double flash_threshold = */ 0.25, \
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold, \
- /* double upper_hr_threshold = */ 0.999f, \
- /* double decrement = */ 0.9f, \
+ /* double upper_hr_threshold = */ 0.999, \
+ /* double decrement = */ 0.9, \
/* hbool_t apply_max_decrement = */ TRUE, \
/* size_t max_decrement = */ (1 * 1024 * 1024), \
/* int epochs_before_eviction = */ 3, \
/* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1f, \
+ /* double empty_reserve = */ 0.1, \
/* size_t dirty_bytes_threshold = */ (256 * 1024), \
/* int metadata_write_strategy = */ \
H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
@@ -270,29 +270,29 @@ typedef struct H5AC_proxy_entry_t {
/* hbool_t evictions_enabled = */ TRUE, \
/* hbool_t set_initial_size = */ TRUE, \
/* size_t initial_size = */ ( 2 * 1024 * 1024), \
- /* double min_clean_fraction = */ 0.01f, \
+ /* double min_clean_fraction = */ 0.01, \
/* size_t max_size = */ (32 * 1024 * 1024), \
/* size_t min_size = */ ( 1 * 1024 * 1024), \
/* long int epoch_length = */ 50000, \
/* enum H5C_cache_incr_mode incr_mode = */ H5C_incr__threshold, \
- /* double lower_hr_threshold = */ 0.9f, \
- /* double increment = */ 2.0f, \
+ /* double lower_hr_threshold = */ 0.9, \
+ /* double increment = */ 2.0, \
/* hbool_t apply_max_increment = */ TRUE, \
/* size_t max_increment = */ (4 * 1024 * 1024), \
/* enum H5C_cache_flash_incr_mode */ \
/* flash_incr_mode = */ H5C_flash_incr__add_space, \
- /* double flash_multiple = */ 1.4f, \
- /* double flash_threshold = */ 0.25f, \
+ /* double flash_multiple = */ 1.4, \
+ /* double flash_threshold = */ 0.25, \
/* enum H5C_cache_decr_mode decr_mode = */ H5C_decr__age_out_with_threshold,\
- /* double upper_hr_threshold = */ 0.999f, \
- /* double decrement = */ 0.9f, \
+ /* double upper_hr_threshold = */ 0.999, \
+ /* double decrement = */ 0.9, \
/* hbool_t apply_max_decrement = */ TRUE, \
/* size_t max_decrement = */ (1 * 1024 * 1024), \
/* int epochs_before_eviction = */ 3, \
/* hbool_t apply_empty_reserve = */ TRUE, \
- /* double empty_reserve = */ 0.1f, \
+ /* double empty_reserve = */ 0.1, \
/* size_t dirty_bytes_threshold = */ (256 * 1024), \
- /* int metadata_write_strategy = */ \
+ /* int metadata_write_strategy = */ \
H5AC__DEFAULT_METADATA_WRITE_STRATEGY \
}
#endif /* H5_HAVE_PARALLEL */
diff --git a/src/H5Adeprec.c b/src/H5Adeprec.c
index 3d4e391..8ae4e41 100644
--- a/src/H5Adeprec.c
+++ b/src/H5Adeprec.c
@@ -309,10 +309,11 @@ done:
int
H5Aget_num_attrs(hid_t loc_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_info2_t oinfo;
- int ret_value = -1;
+ H5VL_object_t * vol_obj = NULL; /* 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;
+ int ret_value = -1;
FUNC_ENTER_API((-1))
H5TRACE1("Is", "i", loc_id);
@@ -324,9 +325,13 @@ H5Aget_num_attrs(hid_t loc_id)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "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_NUM_ATTRS;
+
/* Get the number of attributes for the object */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &oinfo, H5O_INFO_NUM_ATTRS) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, (-1), "unable to get attribute count for object")
H5_CHECKED_ASSIGN(ret_value, int, oinfo.num_attrs, hsize_t);
@@ -375,8 +380,10 @@ done:
herr_t
H5Aiterate1(hid_t loc_id, unsigned *attr_num /*in,out*/, H5A_operator1_t op, void *op_data)
{
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
- herr_t ret_value; /* 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_attr_optional_args_t attr_opt_args; /* Arguments for optional operation */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(H5_ITER_ERROR)
H5TRACE4("e", "i*IuAo*x", loc_id, attr_num, op, op_data);
@@ -389,9 +396,17 @@ H5Aiterate1(hid_t loc_id, unsigned *attr_num /*in,out*/, H5A_operator1_t op, voi
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ATTR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ attr_opt_args.iterate_old.loc_id = loc_id;
+ attr_opt_args.iterate_old.attr_num = attr_num;
+ attr_opt_args.iterate_old.op = op;
+ attr_opt_args.iterate_old.op_data = op_data;
+ vol_cb_args.op_type = H5VL_NATIVE_ATTR_ITERATE_OLD;
+ vol_cb_args.args = &attr_opt_args;
+
/* Call attribute iteration routine */
- if ((ret_value = H5VL_attr_optional(vol_obj, H5VL_NATIVE_ATTR_ITERATE_OLD, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, loc_id, attr_num, op, op_data)) < 0)
+ if ((ret_value = H5VL_attr_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL)) <
+ 0)
HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
diff --git a/src/H5Aint.c b/src/H5Aint.c
index 8ec5463..300d686 100644
--- a/src/H5Aint.c
+++ b/src/H5Aint.c
@@ -844,7 +844,6 @@ done:
const void *buf; IN: Buffer of data to write
RETURNS
Non-negative on success/Negative on failure
-
DESCRIPTION
This function writes a complete attribute to disk.
--------------------------------------------------------------------------*/
@@ -949,31 +948,33 @@ done:
NAME
H5A__get_name
PURPOSE
- Private function for H5Aget_name. Gets a copy of the name for an
- attribute
+ Gets a copy of the name for an attribute
RETURNS
- This function returns the length of the attribute's name (which may be
- longer than 'buf_size') on success or negative for failure.
+ Non-negative on success/Negative on failure
DESCRIPTION
This function retrieves the name of an attribute for an attribute ID.
Up to 'buf_size' characters are stored in 'buf' followed by a '\0' string
terminator. If the name of the attribute is longer than 'buf_size'-1,
the string terminator is stored in the last position of the buffer to
properly terminate the string.
+ This function returns the length of the attribute's name (which may be
+ longer than 'buf_size') in the 'attr_name_len' parameter.
--------------------------------------------------------------------------*/
-ssize_t
-H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
+herr_t
+H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len)
{
- size_t copy_len, nbytes;
- ssize_t ret_value = -1; /* Return value */
+ size_t copy_len, nbytes;
FUNC_ENTER_PACKAGE_NOERR
- /* get the real attribute length */
+ /* Sanity checks */
+ HDassert(attr);
+ HDassert(attr_name_len);
+
+ /* Get the real attribute length */
nbytes = HDstrlen(attr->shared->name);
- HDassert((ssize_t)nbytes >= 0); /*overflow, pretty unlikely --rpm*/
- /* compute the string length which will fit into the user's buffer */
+ /* Compute the string length which will fit into the user's buffer */
copy_len = MIN(buf_size - 1, nbytes);
/* Copy all/some of the name */
@@ -984,10 +985,10 @@ H5A__get_name(H5A_t *attr, size_t buf_size, char *buf)
buf[copy_len] = '\0';
} /* end if */
- /* Set return value */
- ret_value = (ssize_t)nbytes;
+ /* Set actual attribute name length */
+ *attr_name_len = nbytes;
- FUNC_LEAVE_NOAPI(ret_value)
+ FUNC_LEAVE_NOAPI(SUCCEED)
} /* H5A__get_name() */
/*-------------------------------------------------------------------------
@@ -1091,13 +1092,10 @@ done:
NAME
H5A__get_create_plist
PURPOSE
- private version of H5Aget_create_plist
+ Private version of H5Aget_create_plist
RETURNS
This function returns the ID of a copy of the attribute's creation
property list, or negative on failure.
-
- ERRORS
-
DESCRIPTION
This function returns a copy of the creation property list for
an attribute. The resulting ID must be closed with H5Pclose() or
@@ -1304,7 +1302,7 @@ H5A__close_cb(H5VL_object_t *attr_vol_obj, void **request)
HDassert(attr_vol_obj);
/* Close the attribute */
- if ((ret_value = H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, request)) < 0)
+ if (H5VL_attr_close(attr_vol_obj, H5P_DATASET_XFER_DEFAULT, request) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CLOSEERROR, FAIL, "problem closing attribute")
/* Free the VOL object */
@@ -2768,7 +2766,7 @@ H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type, H5
/* Call internal attribute iteration routine */
if ((ret_value = H5A__iterate_common(obj_loc_id, idx_type, order, idx, &attr_op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
+ HERROR(H5E_ATTR, H5E_BADITER, "error iterating over attributes");
done:
/* Release resources */
diff --git a/src/H5Amodule.h b/src/H5Amodule.h
index c89c93f..9f86ddd 100644
--- a/src/H5Amodule.h
+++ b/src/H5Amodule.h
@@ -33,33 +33,29 @@
*
* Use the functions in this module to manage HDF5 attributes.
*
- * The Attribute Interface, H5A, provides a mechanism for attaching additional
- * information to a dataset, group, or named datatype.
- *
- * Attributes are accessed by opening the object that they are attached to and
- * are not independent objects. Typically an attribute is small in size and
- * contains user metadata about the object that it is attached to.
- *
- * Attributes look similar to HDF5 datasets in that they have a datatype and
- * dataspace. However, they do not support partial I/O operations and cannot be
- * compressed or extended.
+ * Like HDF5 datasets, HDF5 attributes are array variables which have an element
+ * datatype and a shape (dataspace). However, they perform a different function:
+ * Attributes decorate other HDF5 objects, and are typically used to
+ * represent application metadata. Unlike datasets, the HDF5 library does not
+ * support partial I/O operations for attributes and they cannot be compressed
+ * or extended.
*
* <table>
* <tr><th>Create</th><th>Read</th></tr>
* <tr valign="top">
* <td>
- * \snippet H5A_examples.c create
+ * \snippet{lineno} H5A_examples.c create
* </td>
* <td>
- * \snippet H5A_examples.c read
+ * \snippet{lineno} H5A_examples.c read
* </td>
* <tr><th>Update</th><th>Delete</th></tr>
* <tr valign="top">
* <td>
- * \snippet H5A_examples.c update
+ * \snippet{lineno} H5A_examples.c update
* </td>
* <td>
- * \snippet H5A_examples.c delete
+ * \snippet{lineno} H5A_examples.c delete
* </td>
* </tr>
* </table>
diff --git a/src/H5Apkg.h b/src/H5Apkg.h
index a349f9f..b50cbc4 100644
--- a/src/H5Apkg.h
+++ b/src/H5Apkg.h
@@ -200,14 +200,14 @@ H5_DLL herr_t H5A__iterate(const H5G_loc_t *loc, const char *obj_name, H5_index_
#ifndef H5_NO_DEPRECATED_SYMBOLS
H5_DLL herr_t H5A__iterate_old(hid_t loc_id, unsigned *attr_num, H5A_operator1_t op, void *op_data);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
-H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name);
-H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name,
- hbool_t *attr_exists);
-H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf);
-H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf);
-H5_DLL ssize_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf);
+H5_DLL herr_t H5A__delete_by_name(const H5G_loc_t *loc, const char *obj_name, const char *attr_name);
+H5_DLL herr_t H5A__delete_by_idx(const H5G_loc_t *loc, const char *obj_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5A__exists_by_name(H5G_loc_t loc, const char *obj_name, const char *attr_name,
+ hbool_t *attr_exists);
+H5_DLL herr_t H5A__write(H5A_t *attr, const H5T_t *mem_type, const void *buf);
+H5_DLL herr_t H5A__read(const H5A_t *attr, const H5T_t *mem_type, void *buf);
+H5_DLL herr_t H5A__get_name(H5A_t *attr, size_t buf_size, char *buf, size_t *attr_name_len);
/* Attribute "dense" storage routines */
H5_DLL herr_t H5A__dense_create(H5F_t *f, H5O_ainfo_t *ainfo);
diff --git a/src/H5Apublic.h b/src/H5Apublic.h
index b3da77f..b78ae05 100644
--- a/src/H5Apublic.h
+++ b/src/H5Apublic.h
@@ -78,11 +78,11 @@ extern "C" {
*
* \return \herr_t
*
- * \details H5Aclose() terminates access to the attribute specified by
- * \p attr_id by releasing the identifier.
+ * \details H5Aclose() terminates access to the attribute through
+ * \p attr_id and releases the identifier.
*
- * \attention Further use of a released attribute identifier is illegal; a
- * function using such an identifier will generate an error.
+ * \par Example
+ * \snippet H5A_examples.c create
*
* \since 1.0.0
*
@@ -117,27 +117,19 @@ H5_DLL herr_t H5Aclose_async(const char *app_file, const char *app_func, unsigne
* The attribute name, \p attr_name, must be unique for the object.
*
* The attribute is created with the specified datatype and dataspace,
- * \p type_id and \p space_id, which are created with the H5T and
- * H5S interfaces, respectively.
+ * \p type_id and \p space_id.
*
- * If \p type_id is either a fixed-length or variable-length string,
- * it is important to set the string length when defining the
- * datatype. String datatypes are derived from #H5T_C_S1 (or
- * #H5T_FORTRAN_S1 for Fortran), which defaults to 1 character in
- * size. See H5Tset_size() and Creating variable-length string
- * datatypes.
- *
- * The access property list is currently unused, but will be used in
- * the future. This property list should currently be #H5P_DEFAULT.
+ * \plist_unused{acpl}
*
* The attribute identifier returned by this function must be released
* with H5Aclose() resource leaks will develop.
*
- * \note The \p aapl parameter is currently not used; specify #H5P_DEFAULT.
- *
* \note If \p loc_id is a file identifier, the attribute will be attached
* that file’s root group.
*
+ * \par Example
+ * \snippet H5A_examples.c create
+ *
* \since 1.8.0
*
* \see H5Aclose()
@@ -175,28 +167,19 @@ H5_DLL hid_t H5Acreate_async(const char *app_file, const char *app_func, unsigne
* attached to the object specified by \p loc_id and \p obj_name.
*
* \p loc_id is a location identifier; \p obj_name is the object
- * name relative to \p loc_id. If \p loc_id fully specifies the
- * object to which the attribute is to be attached, \p obj_name
- * should be '.' (a dot).
+ * name relative to \p loc_id.
*
* The attribute name, \p attr_name, must be unique for the object.
*
* The attribute is created with the specified datatype and
- * dataspace, \p type_id and \p space_id, which are created with
- * the H5T and H5S interfaces respectively.
+ * dataspace, \p type_id and \p space_id.
*
- * The attribute creation and access property lists are currently
- * unused, but will be used in the future for optional attribute
- * creation and access properties. These property lists should
- * currently be #H5P_DEFAULT.
+ * \plist_unused{aapl}
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
* the object, \p obj_name.
*
- * The attribute identifier returned by this function must be
- * released with H5close() or resource leaks will develop.
- *
* \since 1.8.0
*
*/
@@ -224,10 +207,14 @@ H5_DLL hid_t H5Acreate_by_name_async(const char *app_file, const char *app_func,
*
* \details H5Adelete() removes the attribute specified by its name,
* \p attr_name, from a file, dataset, group, or named datatype.
- * This function should not be used when attribute identifiers
- * are open on \p loc_id as it may cause the internal indexes of
- * the attributes to change and future writes to the open
- * attributes to produce incorrect results.
+ *
+ * \attention This function should not be used when other attribute identifiers
+ * are open on \p loc_id. This may cause the internal indexes of
+ * the attributes to change and future writes to the open
+ * attributes to produce incorrect results.
+ *
+ * \par Example
+ * \snippet H5A_examples.c delete
*
* \since 1.0.0
*
@@ -254,27 +241,16 @@ H5_DLL herr_t H5Adelete(hid_t loc_id, const char *attr_name);
*
* The object from which the attribute is to be removed is
* specified by a location identifier and name, \p loc_id and
- * \p obj_name, respectively. If \p loc_id fully specifies the
- * object from which the attribute is to be removed, \p obj_name
- * should be '.' (a dot).
+ * \p obj_name, respectively.
*
* The attribute to be removed is specified by a position in an
- * index, \p n. The type of index is specified by \p idx_type and
- * may be #H5_INDEX_NAME, for an alpha-numeric index by name, or
- * #H5_INDEX_CRT_ORDER, for an index by creation order. The order
- * in which the index is to be traversed is specified by \p order
- * and may be #H5_ITER_INC (increment) for top-down iteration,
- * #H5_ITER_DEC (decrement) for bottom-up iteration, or
- * #H5_ITER_NATIVE, in which case HDF5 will iterate in the
- * fastest-available order. For example, if \p idx_type, \p order,
+ * index, \p n. The type of index is specified by \p idx_type.
+ * The order in which the index is to be traversed is specified by
+ * \p order. For example, if \p idx_type, \p order,
* and \p n are set to #H5_INDEX_NAME, #H5_ITER_INC, and 5,
- * respectively, the fifth attribute by alpha-numeric order of
+ * respectively, the fifth attribute in lexicographic order of
* attribute names will be removed.
*
- * For a discussion of \p idx_type and \p order, the valid values
- * of those parameters, and the use of \p n, see the description
- * of H5Aiterate2().
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
* the object, \p obj_name.
@@ -302,9 +278,6 @@ H5_DLL herr_t H5Adelete_by_idx(hid_t loc_id, const char *obj_name, H5_index_t id
* from an object specified by location and name, \p loc_id and
* \p obj_name, respectively.
*
- * If \p loc_id fully specifies the object from which the
- * attribute is to be removed, \p obj_name should be '.' (a dot).
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to
* access the object, \p obj_name.
@@ -360,9 +333,7 @@ H5_DLL herr_t H5Aexists_async(const char *app_file, const char *app_func, unsign
* \p loc_id specifies a location in the file containing the object.
* \p obj_name is the name of the object to which the attribute is
* attached and can be a relative name, relative to \p loc_id,
- * or an absolute name, based in the root group of the file. If
- * \p loc_id fully specifies the object, \p obj_name should be '.'
- * (a dot).
+ * or an absolute name, based in the root group of the file.
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -394,9 +365,6 @@ H5_DLL herr_t H5Aexists_by_name_async(const char *app_file, const char *app_func
* creation property list associated with the attribute specified
* by \p attr_id.
*
- * The creation property list identifier should be released with
- * H5Pclose().
- *
* \since 1.8.0
*
*/
@@ -413,32 +381,9 @@ H5_DLL hid_t H5Aget_create_plist(hid_t attr_id);
* \return \herr_t
*
* \details H5Aget_info() retrieves attribute information, locating the
- * attribute with an attribute identifier, \p attr_id, which is
- * the identifier returned by H5Aopen() or H5Aopen_by_idx(). The
+ * attribute with an attribute identifier, \p attr_id. The
* attribute information is returned in the \p ainfo struct.
*
- * The \p ainfo struct is defined as follows:
- * \snippet this H5A_info_t_snip
- *
- * \p corder_valid indicates whether the creation order data is
- * valid for this attribute. Note that if creation order is not
- * being tracked, no creation order data will be valid. Valid
- * values are \c TRUE and \c FALSE.
- *
- * \p corder is a positive integer containing the creation
- * order of the attribute. This value is 0-based, so, for
- * example, the third attribute created will have a \p corder
- * value of 2.
- *
- * \p cset indicates the character set used for the attribute’s
- * name; valid values are defined in H5Tpublic.h and include
- * the following:
- * \csets
- * This value is set with H5Pset_char_encoding().
- *
- * \p data_size indicates the size, in the number of characters,
- * of the attribute.
- *
* \since 1.8.0
*
*/
@@ -466,16 +411,9 @@ H5_DLL herr_t H5Aget_info(hid_t attr_id, H5A_info_t *ainfo /*out*/);
* The attribute is located by its index position and the attribute
* information is returned in the \p ainfo struct.
*
- * If \p loc_id fully specifies the object to which the attribute
- * is attached, \p obj_name should be '.' (a dot).
- *
* The attribute is located by means of an index type, an index
* traversal order, and a position in the index, \p idx_type,
- * \p order and \p n, respectively. These parameters and their
- * valid values are discussed in the description of H5Aiterate2().
- *
- * The \p ainfo struct, which will contain the returned attribute
- * information, is described in H5Aget_info().
+ * \p order and \p n, respectively.
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -493,8 +431,7 @@ H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t
* \brief Retrieves attribute information, by attribute name
*
* \fgdt_loc_id
- *
- * \param[in] obj_name Name of object to which attribute is attached,
+ * \param[in] obj_name Name of the object to which an attribute is attached,
* relative to location
* \param[in] attr_name Attribute name
* \param[out] ainfo Struct containing returned attribute information
@@ -507,11 +444,6 @@ H5_DLL herr_t H5Aget_info_by_idx(hid_t loc_id, const char *obj_name, H5_index_t
* location and name, \p loc_id and \p obj_name, respectively.
* The attribute information is returned in the \p ainfo struct.
*
- * If \p loc_id fully specifies the object to which the attribute
- * is attached, \p obj_name should be '.' (a dot).
- *
- * The \p ainfo struct is described in H5Aget_info().
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to
* access the object, \p obj_name.
@@ -542,8 +474,8 @@ H5_DLL herr_t H5Aget_info_by_name(hid_t loc_id, const char *obj_name, const char
* string terminator is stored in the last position of the buffer
* to properly terminate the string.
*
- * If the user only wants to find out the size of this name, the
- * values 0 and NULL can be passed in for the parameters
+ * If the user only wants to retrieve the name length, the
+ * values 0 and NULL should be passed for the parameters
* \p bufsize and \p buf.
*
* \since 1.0.0
@@ -554,7 +486,7 @@ H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
/**
* \ingroup H5A
*
- * \brief Gets an attribute name, by attribute index position
+ * \brief Gets an attribute name by attribute index position
*
* \fgdt_loc_id
* \param[in] obj_name Name of object to which attribute is attached,
@@ -575,13 +507,9 @@ H5_DLL ssize_t H5Aget_name(hid_t attr_id, size_t buf_size, char *buf);
* located by its index position, the size of the name is specified
* in \p size, and the attribute name is returned in \p name.
*
- * If \p loc_id fully specifies the object to which the attribute
- * is attached, \p obj_name should be '.' (a dot).
- *
* The attribute is located by means of an index type, an index
* traversal order, and a position in the index, \p idx_type,
- * \p order and \p n, respectively. These parameters and their
- * valid values are discussed in the description of H5Aiterate2().
+ * \p order and \p n, respectively.
*
* If the attribute name’s size is unknown, the values 0 and NULL
* can be passed in for the parameters \p size and \p name. The
@@ -621,7 +549,7 @@ H5_DLL hid_t H5Aget_space(hid_t attr_id);
/**
* \ingroup H5A
*
- * \brief Returns the amount of storage required for an attribute
+ * \brief Returns the amount of storage used to store an attribute
*
* \attr_id
*
@@ -639,17 +567,16 @@ H5_DLL hsize_t H5Aget_storage_size(hid_t attr_id);
/**
* \ingroup H5A
*
- * \brief Gets an attribute datatype
+ * \brief Gets an attribute's datatype
*
* \attr_id
*
* \return \hid_t{datatype}
*
- * \details H5Aget_type() retrieves a copy of the datatype for an attribute.
+ * \details H5Aget_type() retrieves a copy of the attribute's datatype.
* The datatype is reopened if it is a named type before returning
* it to the application. The datatypes returned by this function
- * are always read-only. If an error occurs when atomizing the
- * return datatype, then the datatype is closed.
+ * are always read-only.
*
* The datatype identifier returned from this function must be
* released with H5Tclose() or resource leaks will develop.
@@ -662,7 +589,7 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id);
/**
* \ingroup H5A
*
- * \brief Calls user-defined function for each attribute on an object
+ * \brief Calls a user-defined function for each attribute on an object
*
* \fgdt_loc_id
* \param[in] idx_type Type of index
@@ -689,17 +616,6 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id);
* are specified by three parameters: the index type,
* \p idx_type; the order in which the index is to be traversed,
* \p order; and the attribute’s position in the index, \p idx.
- *
- * The type of index specified by \p idx_type can be one of the
- * following:
- *
- * \indexes
- *
- * The order in which the index is to be traversed, as specified
- * by \p order, can be one of the following:
- *
- * \orders
- *
* The next attribute to be operated on is specified by \p idx,
* a position in the index.
*
@@ -716,11 +632,6 @@ H5_DLL hid_t H5Aget_type(hid_t attr_id);
* the value returned identifies the parameter to be operated on
* in the next step of the iteration.
*
- * \p op is a user-defined function whose prototype is defined
- * as follows:
- * \snippet this H5A_operator2_t_snip
- * \click4more
- *
* \note This function is also available through the H5Aiterate() macro.
*
* \since 1.8.0
@@ -756,24 +667,10 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord
* additional information as defined below, is passed to a
* user-defined function, \p op, which operates on that attribute.
*
- * If \p loc_id fully specifies the object to which these
- * attributes are attached, \p obj_name should be '.' (a dot).
- *
* The order of the iteration and the attributes iterated over
* are specified by three parameters: the index type, \p idx_type;
* the order in which the index is to be traversed, \p order;
* and the attribute’s position in the index, \p idx.
- *
- * The type of index specified by \p idx_type can be one of the
- * following:
- *
- * \indexes
- *
- * The order in which the index is to be traversed, as specified
- * by \p order, can be one of the following:
- *
- * \orders
- *
* The next attribute to be operated on is specified by \p idx,
* a position in the index.
*
@@ -790,25 +687,6 @@ H5_DLL herr_t H5Aiterate2(hid_t loc_id, H5_index_t idx_type, H5_iter_order_t ord
* the value returned identifies the parameter to be operated on in
* the next step of the iteration.
*
- * \p op is a user-defined function whose prototype is defined
- * as follows:
- * \snippet this H5A_operator2_t_snip
- * \click4more
- *
- * Valid return values from an operator and the resulting
- * H5Aiterate_by_name() and \p op behavior are as follows:
- *
- * \li Zero causes the iterator to continue, returning zero when
- * all attributes have been processed.
- * \li A positive value causes the iterator to immediately return
- * that positive value, indicating short-circuit success.
- * The iterator can be restarted at the next attribute, as
- * indicated by the return value of \p idx.
- * \li A negative value causes the iterator to immediately return
- * that value, indicating failure. The iterator can be
- * restarted at the next attribute, as indicated by the return
- * value of \p idx.
- *
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
* the object, \p obj_name.
@@ -835,8 +713,7 @@ H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t
* \details H5Aopen() opens an existing attribute, \p attr_name, that is
* attached to object specified by an object identifier, \p obj_id.
*
- * The attribute access property list, \p aapl_id, is currently unused
- * and should be #H5P_DEFAULT.
+ * \plist_unused{aapl_id}
*
* This function, H5Aopen_by_idx() or H5Aopen_by_name() must be called
* before the attribute can be accessed for any further purpose,
@@ -845,6 +722,9 @@ H5_DLL herr_t H5Aiterate_by_name(hid_t loc_id, const char *obj_name, H5_index_t
* The attribute identifier returned by this function must be released
* with H5Aclose() or resource leaks will develop.
*
+ * \par Example
+ * \snippet H5A_examples.c read
+ *
* \since 1.8.0
*
* \see H5Aclose(), H5Acreate()
@@ -876,17 +756,13 @@ H5_DLL hid_t H5Aopen_async(const char *app_file, const char *app_func, unsigned
*
* \details H5Aopen_by_idx() opens an existing attribute that is attached
* to an object specified by location and name, \p loc_id and
- * \p obj_name, respectively. If \p loc_id fully specifies the
- * object to which the attribute is attached, \p obj_name, should
- * be '.' (a dot).
+ * \p obj_name, respectively.
*
* The attribute is identified by an index type, an index traversal
* order, and a position in the index, \p idx_type, \p order and
- * \p n, respectively. These parameters and their valid values are
- * discussed in the description of H5Aiterate2().
+ * \p n, respectively.
*
- * The attribute access property list, \p aapl_id, is currently
- * unused and should currently be #H5P_DEFAULT.
+ * \plist_unused{aapl_id}
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -933,11 +809,9 @@ H5_DLL hid_t H5Aopen_by_idx_async(const char *app_file, const char *app_func, un
*
* \p loc_id specifies a location from which the target object can
* be located and \p obj_name is an object name relative to
- * \p loc_id. If \p loc_id fully specifies the object to which the
- * attribute is attached, \p obj_name should be '.' (a dot).
+ * \p loc_id.
*
- * The attribute access property list, \p aapl_id, is currently
- * unused and should currently be #H5P_DEFAULT.
+ * \plist_unused{aapl_id}
*
* The link access property list, \p lapl_id, may provide
* information regarding the properties of links required to access
@@ -982,6 +856,9 @@ H5_DLL hid_t H5Aopen_by_name_async(const char *app_file, const char *app_func, u
* Datatype conversion takes place at the time of a read or write and
* is automatic.
*
+ * \par Example
+ * \snippet H5A_examples.c read
+ *
* \version 1.8.8 Fortran updated to Fortran2003.
* \version 1.4.2 The \p dims parameter was added to the Fortran API in this
* release.
@@ -1051,15 +928,12 @@ H5_DLL herr_t H5Arename_by_name_async(const char *app_file, const char *app_func
* attribute's in-memory datatype is specified with \p type_id.
* The entire attribute is written from \p buf to the file.
*
- * If \p type_id is either a fixed-length or variable-length string,
- * it is important to set the string length when defining the datatype.
- * String datatypes are derived from #H5T_C_S1 (or #H5T_FORTRAN_S1 for
- * Fortran codes), which defaults to 1 character in size.
- * See H5Tset_size() and Creating variable-length string datatypes.
- *
* Datatype conversion takes place at the time of a read or write and
* is automatic.
*
+ * \par Example
+ * \snippet H5A_examples.c update
+ *
* \version 1.8.8 Fortran updated to Fortran2003.
* \version 1.4.2 Fortran \p dims parameter added in this release
* \since 1.0.0
@@ -1100,6 +974,7 @@ H5_DLL herr_t H5Awrite_async(const char *app_file, const char *app_func, unsigne
H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *old_attr_name,
const char *new_attr_name, hid_t lapl_id);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1133,6 +1008,7 @@ H5_DLL herr_t H5Arename_by_name(hid_t loc_id, const char *obj_name, const char *
#define H5Aexists_by_name_async_wrap H5_NO_EXPAND(H5Aexists_by_name_async)
#define H5Aclose_async_wrap H5_NO_EXPAND(H5Aclose_async)
#endif /* H5A_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -1182,9 +1058,9 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_nam
*
* \return \hid_tv{attribute}
*
- * \note The \p acpl parameters is currently not used; specify #H5P_DEFAULT.
+ * \deprecation_note{H5Acreate2()}
*
- * \deprecated Deprecated in favor of H5Acreate2()
+ * \plist_unused{acpl}
*
* \details H5Acreate1() creates an attribute, \p name, which is attached
* to the object specified by the identifier \p loc_id.
@@ -1192,18 +1068,7 @@ typedef herr_t (*H5A_operator1_t)(hid_t location_id /*in*/, const char *attr_nam
* The attribute name, \p name, must be unique for the object.
*
* The attribute is created with the specified datatype and dataspace,
- * \p type_id and \p space_id, which are created with the H5T and
- * H5S interfaces, respectively.
- *
- * If \p type_id is either a fixed-length or variable-length string,
- * it is important to set the string length when defining the
- * datatype. String datatypes are derived from #H5T_C_S1 (or
- * #H5T_FORTRAN_S1 for Fortran), which defaults to 1 character in
- * size. See H5Tset_size() and Creating variable-length string
- * datatypes.
- *
- * The attribute identifier returned by this function must be released
- * with H5Aclose() resource leaks will develop.
+ * \p type_id and \p space_id.
*
* \since 1.8.0
*
@@ -1225,8 +1090,7 @@ H5_DLL hid_t H5Acreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t spa
* \return Returns the number of attributes if successful; otherwise returns
* a negative value.
*
- * \deprecated This function is deprecated in favor of the functions
- * H5Oget_info(), H5Oget_info_by_name(), and H5Oget_info_by_idx().
+ * \deprecation_note{H5Oget_info(), H5Oget_info_by_name(), and H5Oget_info_by_idx()}
*
* \details H5Aget_num_attrs() returns the number of attributes attached to
* the object specified by its identifier, \p loc_id.
@@ -1249,8 +1113,7 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id);
*
* \return \herr_t
*
- * \deprecated This function is deprecated in favor of the function
- * H5Aiterate2().
+ * \deprecation_note{H5Aiterate2()}
*
* \details H5Aiterate1() iterates over the attributes of the object
* specified by its identifier, \p loc_id. The object can be a
@@ -1262,10 +1125,6 @@ H5_DLL int H5Aget_num_attrs(hid_t loc_id);
* \p op, is returned in \p idx. If \p idx is the null pointer,
* then all attributes are processed.
*
- * \p op is a user-defined function whose prototype is defined as follows:
- * \snippet this H5A_operator1_t_snip
- * \click4more
- *
* \version 1.8.0 The function \p H5Aiterate was renamed to H5Aiterate1()
* and deprecated in this release.
* \since 1.0.0
@@ -1283,8 +1142,7 @@ H5_DLL herr_t H5Aiterate1(hid_t loc_id, unsigned *idx, H5A_operator1_t op, void
*
* \return \hid_tv{attribute}
*
- * \deprecated This function is deprecated in favor of the function
- * H5Aopen_by_idx().
+ * \deprecation_note{H5Aopen_by_idx()}
*
* \details H5Aopen_idx() opens an attribute which is attached to the
* object specified with \p loc_id . The location object may be
@@ -1310,8 +1168,7 @@ H5_DLL hid_t H5Aopen_idx(hid_t loc_id, unsigned idx);
*
* \return \hid_tv{attribute}
*
- * \deprecated This function is deprecated in favor of the function
- * H5Aopen_by_name().
+ * \deprecation_note{H5Aopen_by_name()}
*
* \details H5Aopen_name() opens an attribute specified by its name,
* \p name, which is attached to the object specified with
diff --git a/src/H5B2int.c b/src/H5B2int.c
index 610da6c..ab43a5a 100644
--- a/src/H5B2int.c
+++ b/src/H5B2int.c
@@ -52,9 +52,9 @@
/********************/
/* Local Prototypes */
/********************/
-static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth,
- const H5B2_node_ptr_t *node_ptrs, unsigned start_idx,
- unsigned end_idx, void *old_parent, void *new_parent);
+static herr_t H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptrs,
+ unsigned start_idx, unsigned end_idx, void *old_parent,
+ void *new_parent);
/*********************/
/* Package Variables */
@@ -1617,7 +1617,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
H5B2_operator_t op, void *op_data)
{
const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
@@ -1642,8 +1642,7 @@ H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_
/* Lock the current B-tree node */
if (NULL ==
- (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
- H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
+ (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Set up information about current node */
@@ -1739,8 +1738,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
- H5B2_remove_t op, void *op_data)
+H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent, H5B2_remove_t op,
+ void *op_data)
{
const H5AC_class_t *curr_node_class = NULL; /* Pointer to current node's class info */
void * node = NULL; /* Pointers to current node */
@@ -1759,8 +1758,7 @@ H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_n
/* Lock the current B-tree node */
if (NULL ==
- (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
- H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Set up information about current node */
@@ -1824,7 +1822,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
hsize_t *btree_size)
{
H5B2_internal_t *internal = NULL; /* Pointer to internal node */
@@ -1839,8 +1837,8 @@ H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_nod
HDassert(depth > 0);
/* Lock the current B-tree node */
- if (NULL == (internal = H5B2__protect_internal(hdr, parent, (H5B2_node_ptr_t *)curr_node, depth, FALSE,
- H5AC__READ_ONLY_FLAG))) /* Casting away const OK -QAK */
+ if (NULL ==
+ (internal = H5B2__protect_internal(hdr, parent, curr_node, depth, FALSE, H5AC__READ_ONLY_FLAG)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
/* Recursively descend into child nodes, if we are above the "twig" level in the B-tree */
@@ -1910,7 +1908,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr, void *old_parent,
+H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptr, void *old_parent,
void *new_parent)
{
const H5AC_class_t *child_class; /* Pointer to child node's class info */
@@ -1941,9 +1939,8 @@ H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t
H5B2_internal_t *child_int;
/* Protect child */
- if (NULL == (child_int = H5B2__protect_internal(
- hdr, new_parent, (H5B2_node_ptr_t *)node_ptr, (uint16_t)(depth - 1), FALSE,
- H5AC__NO_FLAGS_SET))) /* Casting away const OK -QAK */
+ if (NULL == (child_int = H5B2__protect_internal(hdr, new_parent, node_ptr, (uint16_t)(depth - 1),
+ FALSE, H5AC__NO_FLAGS_SET)))
HGOTO_ERROR(H5E_BTREE, H5E_CANTPROTECT, FAIL, "unable to protect B-tree internal node")
child_class = H5AC_BT2_INT;
child = child_int;
@@ -2010,7 +2007,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptrs,
+H5B2__update_child_flush_depends(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptrs,
unsigned start_idx, unsigned end_idx, void *old_parent, void *new_parent)
{
unsigned u; /* Local index variable */
diff --git a/src/H5B2pkg.h b/src/H5B2pkg.h
index 8d620cc..66d04fa 100644
--- a/src/H5B2pkg.h
+++ b/src/H5B2pkg.h
@@ -321,7 +321,7 @@ extern const H5B2_class_t *const H5B2_client_class_g[H5B2_NUM_BTREE_ID];
/* Generic routines */
H5_DLL herr_t H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
-H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, const H5B2_node_ptr_t *node_ptr,
+H5_DLL herr_t H5B2__update_flush_depend(H5B2_hdr_t *hdr, unsigned depth, H5B2_node_ptr_t *node_ptr,
void *old_parent, void *new_parent);
H5_DLL herr_t H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry);
@@ -390,9 +390,9 @@ H5_DLL herr_t H5B2__update_leaf(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_node_ptr,
void *op_data);
/* Routines for iterating over nodes/records */
-H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
- void *parent, H5B2_operator_t op, void *op_data);
-H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node, void *parent,
+H5_DLL herr_t H5B2__iterate_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
+ H5B2_operator_t op, void *op_data);
+H5_DLL herr_t H5B2__node_size(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
hsize_t *op_data);
/* Routines for locating records */
@@ -423,8 +423,8 @@ H5_DLL herr_t H5B2__remove_leaf_by_idx(H5B2_hdr_t *hdr, H5B2_node_ptr_t *curr_no
void *op_data);
/* Routines for deleting nodes */
-H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, const H5B2_node_ptr_t *curr_node,
- void *parent, H5B2_remove_t op, void *op_data);
+H5_DLL herr_t H5B2__delete_node(H5B2_hdr_t *hdr, uint16_t depth, H5B2_node_ptr_t *curr_node, void *parent,
+ H5B2_remove_t op, void *op_data);
/* Debugging routines for dumping file structures */
H5_DLL herr_t H5B2__hdr_debug(H5F_t *f, haddr_t addr, FILE *stream, int indent, int fwidth,
diff --git a/src/H5CS.c b/src/H5CS.c
index 6510c25..d7cb6f1 100644
--- a/src/H5CS.c
+++ b/src/H5CS.c
@@ -262,9 +262,9 @@ H5CS_copy_stack(void)
if (NULL == (new_stack->rec = HDcalloc(old_stack->nused, sizeof(const char *))))
HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "can't allocate function stack records")
- /* Copy old stack to new one, duplicating the strings */
- for (u = 0; u < old_stack->nused; u++)
- new_stack->rec[u] = HDstrdup(old_stack->rec[u]);
+ /* Copy pointers on old stack to new one */
+ /* (Strings don't need to be duplicated, they are statically allocated) */
+ HDmemcpy(new_stack->rec, old_stack->rec, sizeof(char *) * old_stack->nused);
new_stack->nused = new_stack->nalloc = old_stack->nused;
/* Set the return value */
@@ -298,11 +298,9 @@ H5CS_close_stack(H5CS_t *stack)
HDassert(stack);
/* Free stack */
- for (u = 0; u < stack->nused; u++) {
- if (stack->rec[u])
- HDfree((void *)stack->rec[u]);
- stack->rec[u] = NULL;
- } /* end for */
+ /* The function name string are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
if (stack->rec) {
HDfree(stack->rec);
stack->rec = NULL;
diff --git a/src/H5CX.c b/src/H5CX.c
index c304548..01bf435 100644
--- a/src/H5CX.c
+++ b/src/H5CX.c
@@ -761,13 +761,14 @@ H5CX__get_context(void)
static void
H5CX__push_common(H5CX_node_t *cnode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_STATIC_NOERR
/* Sanity check */
HDassert(cnode);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head);
/* Set non-zero context info */
cnode->ctx.dxpl_id = H5P_DATASET_XFER_DEFAULT;
@@ -834,7 +835,7 @@ done:
void
H5CX_push_special(void)
{
- H5CX_node_t *cnode; /* Context node */
+ H5CX_node_t *cnode = NULL; /* Context node */
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -868,13 +869,13 @@ H5CX_push_special(void)
herr_t
H5CX_retrieve_state(H5CX_state_t **api_state)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(api_state);
@@ -975,6 +976,16 @@ H5CX_retrieve_state(H5CX_state_t **api_state)
#endif /* H5_HAVE_PARALLEL */
done:
+ /* Cleanup on error */
+ if (ret_value < 0) {
+ if (*api_state) {
+ /* Release the (possibly partially allocated) API state struct */
+ if (H5CX_free_state(*api_state) < 0)
+ HDONE_ERROR(H5E_CONTEXT, H5E_CANTRELEASE, FAIL, "unable to release API state")
+ *api_state = NULL;
+ } /* end if */
+ } /* end if */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5CX_retrieve_state() */
@@ -998,12 +1009,12 @@ done:
herr_t
H5CX_restore_state(const H5CX_state_t *api_state)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(api_state);
@@ -1066,22 +1077,22 @@ H5CX_free_state(H5CX_state_t *api_state)
HDassert(api_state);
/* Release the DCPL */
- if (api_state->dcpl_id != H5P_DATASET_CREATE_DEFAULT)
+ if (0 != api_state->dcpl_id && H5P_DATASET_CREATE_DEFAULT != api_state->dcpl_id)
if (H5I_dec_ref(api_state->dcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DCPL")
/* Release the DXPL */
- if (api_state->dxpl_id != H5P_DATASET_XFER_DEFAULT)
+ if (0 != api_state->dxpl_id && H5P_DATASET_XFER_DEFAULT != api_state->dxpl_id)
if (H5I_dec_ref(api_state->dxpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on DXPL")
/* Release the LAPL */
- if (api_state->lapl_id != H5P_LINK_ACCESS_DEFAULT)
+ if (0 != api_state->lapl_id && H5P_LINK_ACCESS_DEFAULT != api_state->lapl_id)
if (H5I_dec_ref(api_state->lapl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LAPL")
/* Release the LCPL */
- if (api_state->lcpl_id != H5P_LINK_CREATE_DEFAULT)
+ if (0 != api_state->lcpl_id && H5P_LINK_CREATE_DEFAULT != api_state->lcpl_id)
if (H5I_dec_ref(api_state->lcpl_id) < 0)
HGOTO_ERROR(H5E_CONTEXT, H5E_CANTDEC, FAIL, "can't decrement refcount on LCPL")
@@ -1124,15 +1135,19 @@ done:
hbool_t
H5CX_is_def_dxpl(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t is_def_dxpl = FALSE; /* Flag to indicate DXPL is default */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT);
+ /* Set return value */
+ is_def_dxpl = ((*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT);
+
+ FUNC_LEAVE_NOAPI(is_def_dxpl)
} /* end H5CX_is_def_dxpl() */
/*-------------------------------------------------------------------------
@@ -1150,13 +1165,13 @@ H5CX_is_def_dxpl(void)
void
H5CX_set_dxpl(hid_t dxpl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- HDassert(*head);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head && *head);
/* Set the API context's DXPL to a new value */
(*head)->ctx.dxpl_id = dxpl_id;
@@ -1179,13 +1194,13 @@ H5CX_set_dxpl(hid_t dxpl_id)
void
H5CX_set_dcpl(hid_t dcpl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- HDassert(*head);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head && *head);
/* Set the API context's DCPL to a new value */
(*head)->ctx.dcpl_id = dcpl_id;
@@ -1209,13 +1224,13 @@ H5CX_set_dcpl(hid_t dcpl_id)
herr_t
H5CX_set_libver_bounds(H5F_t *f)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -1245,13 +1260,13 @@ done:
void
H5CX_set_lcpl(hid_t lcpl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
- HDassert(*head);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ HDassert(head && *head);
/* Set the API context's LCPL to a new value */
(*head)->ctx.lcpl_id = lcpl_id;
@@ -1274,12 +1289,12 @@ H5CX_set_lcpl(hid_t lcpl_id)
void
H5CX_set_lapl(hid_t lapl_id)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context's LAPL to a new value */
@@ -1314,15 +1329,15 @@ H5CX_set_apl(hid_t *acspl_id, const H5P_libclass_t *libclass,
#endif /* H5_HAVE_PARALLEL */
is_collective)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(acspl_id);
HDassert(libclass);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set access plist to the default property list of the appropriate class if it's the generic default */
@@ -1437,13 +1452,13 @@ H5CX_set_loc(hid_t
loc_id)
{
#ifdef H5_HAVE_PARALLEL
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set collective metadata read flag */
@@ -1491,13 +1506,13 @@ done:
herr_t
H5CX_set_vol_wrap_ctx(void *vol_wrap_ctx)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -1525,13 +1540,13 @@ done:
herr_t
H5CX_set_vol_connector_prop(const H5VL_connector_prop_t *vol_connector_prop)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -1559,15 +1574,19 @@ done:
hid_t
H5CX_get_dxpl(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hid_t dxpl_id = H5I_INVALID_HID; /* DXPL ID for API operation */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.dxpl_id)
+ /* Set return value */
+ dxpl_id = (*head)->ctx.dxpl_id;
+
+ FUNC_LEAVE_NOAPI(dxpl_id)
} /* end H5CX_get_dxpl() */
/*-------------------------------------------------------------------------
@@ -1585,15 +1604,19 @@ H5CX_get_dxpl(void)
hid_t
H5CX_get_lapl(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hid_t lapl_id = H5I_INVALID_HID; /* LAPL ID for API operation */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.lapl_id)
+ /* Set return value */
+ lapl_id = (*head)->ctx.lapl_id;
+
+ FUNC_LEAVE_NOAPI(lapl_id)
} /* end H5CX_get_lapl() */
/*-------------------------------------------------------------------------
@@ -1611,14 +1634,14 @@ H5CX_get_lapl(void)
herr_t
H5CX_get_vol_wrap_ctx(void **vol_wrap_ctx)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_wrap_ctx);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Check for value that was set */
@@ -1647,14 +1670,14 @@ done:
herr_t
H5CX_get_vol_connector_prop(H5VL_connector_prop_t *vol_connector_prop)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_connector_prop);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Check for value that was set */
@@ -1683,15 +1706,19 @@ done:
haddr_t
H5CX_get_tag(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ haddr_t tag = HADDR_UNDEF; /* Current object's tag (ohdr chunk #0 address) */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.tag)
+ /* Set return value */
+ tag = (*head)->ctx.tag;
+
+ FUNC_LEAVE_NOAPI(tag)
} /* end H5CX_get_tag() */
/*-------------------------------------------------------------------------
@@ -1709,15 +1736,19 @@ H5CX_get_tag(void)
H5AC_ring_t
H5CX_get_ring(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ H5AC_ring_t ring = H5AC_RING_INV; /* Current metadata cache ring for entries */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.ring)
+ /* Set return value */
+ ring = (*head)->ctx.ring;
+
+ FUNC_LEAVE_NOAPI(ring)
} /* end H5CX_get_ring() */
#ifdef H5_HAVE_PARALLEL
@@ -1737,15 +1768,19 @@ H5CX_get_ring(void)
hbool_t
H5CX_get_coll_metadata_read(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t coll_md_read = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.coll_metadata_read)
+ /* Set return value */
+ coll_md_read = (*head)->ctx.coll_metadata_read;
+
+ FUNC_LEAVE_NOAPI(coll_md_read)
} /* end H5CX_get_coll_metadata_read() */
/*-------------------------------------------------------------------------
@@ -1765,15 +1800,15 @@ H5CX_get_coll_metadata_read(void)
herr_t
H5CX_get_mpi_coll_datatypes(MPI_Datatype *btype, MPI_Datatype *ftype)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(btype);
HDassert(ftype);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context values */
@@ -1799,15 +1834,19 @@ done:
hbool_t
H5CX_get_mpi_file_flushing(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t flushing = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.mpi_file_flushing)
+ /* Set return value */
+ flushing = (*head)->ctx.mpi_file_flushing;
+
+ FUNC_LEAVE_NOAPI(flushing)
} /* end H5CX_get_mpi_file_flushing() */
/*-------------------------------------------------------------------------
@@ -1826,15 +1865,19 @@ H5CX_get_mpi_file_flushing(void)
hbool_t
H5CX_get_mpio_rank0_bcast(void)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ hbool_t do_rank0_bcast = FALSE;
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
- FUNC_LEAVE_NOAPI((*head)->ctx.rank0_bcast)
+ /* Set return value */
+ do_rank0_bcast = (*head)->ctx.rank0_bcast;
+
+ FUNC_LEAVE_NOAPI(do_rank0_bcast)
} /* end H5CX_get_mpio_rank0_bcast() */
#endif /* H5_HAVE_PARALLEL */
@@ -1853,14 +1896,14 @@ H5CX_get_mpio_rank0_bcast(void)
herr_t
H5CX_get_btree_split_ratios(double split_ratio[3])
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(split_ratio);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1889,14 +1932,14 @@ done:
herr_t
H5CX_get_max_temp_buf(size_t *max_temp_buf)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(max_temp_buf);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1924,14 +1967,14 @@ done:
herr_t
H5CX_get_tconv_buf(void **tconv_buf)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(tconv_buf);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1959,14 +2002,14 @@ done:
herr_t
H5CX_get_bkgr_buf(void **bkgr_buf)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(bkgr_buf);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -1994,14 +2037,14 @@ done:
herr_t
H5CX_get_bkgr_buf_type(H5T_bkg_t *bkgr_buf_type)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(bkgr_buf_type);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2029,14 +2072,14 @@ done:
herr_t
H5CX_get_vec_size(size_t *vec_size)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vec_size);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2066,14 +2109,14 @@ done:
herr_t
H5CX_get_io_xfer_mode(H5FD_mpio_xfer_t *io_xfer_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(io_xfer_mode);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2101,14 +2144,14 @@ done:
herr_t
H5CX_get_mpio_coll_opt(H5FD_mpio_collective_opt_t *mpio_coll_opt)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_coll_opt);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2136,14 +2179,14 @@ done:
herr_t
H5CX_get_mpio_local_no_coll_cause(uint32_t *mpio_local_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_local_no_coll_cause);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2172,14 +2215,14 @@ done:
herr_t
H5CX_get_mpio_global_no_coll_cause(uint32_t *mpio_global_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_global_no_coll_cause);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2208,14 +2251,14 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_mode(H5FD_mpio_chunk_opt_t *mpio_chunk_opt_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_chunk_opt_mode);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2244,14 +2287,14 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_num(unsigned *mpio_chunk_opt_num)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_chunk_opt_num);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2280,14 +2323,14 @@ done:
herr_t
H5CX_get_mpio_chunk_opt_ratio(unsigned *mpio_chunk_opt_ratio)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(mpio_chunk_opt_ratio);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2317,14 +2360,14 @@ done:
herr_t
H5CX_get_err_detect(H5Z_EDC_t *err_detect)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(err_detect);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2352,14 +2395,14 @@ done:
herr_t
H5CX_get_filter_cb(H5Z_cb_t *filter_cb)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(filter_cb);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2387,14 +2430,14 @@ done:
herr_t
H5CX_get_data_transform(H5Z_data_xform_t **data_transform)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(data_transform);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2445,14 +2488,14 @@ done:
herr_t
H5CX_get_vlen_alloc_info(H5T_vlen_alloc_info_t *vl_alloc_info)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vl_alloc_info);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2510,14 +2553,14 @@ done:
herr_t
H5CX_get_dt_conv_cb(H5T_conv_cb_t *dt_conv_cb)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(dt_conv_cb);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2545,14 +2588,14 @@ done:
herr_t
H5CX_get_encoding(H5T_cset_t *encoding)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(encoding);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
@@ -2580,14 +2623,14 @@ done:
herr_t
H5CX_get_intermediate_group(unsigned *crt_intermed_group)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(crt_intermed_group);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.lcpl_id);
@@ -2616,14 +2659,14 @@ done:
herr_t
H5CX_get_nlinks(size_t *nlinks)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(nlinks);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dxpl_id);
@@ -2651,15 +2694,15 @@ done:
herr_t
H5CX_get_libver_bounds(H5F_libver_t *low_bound, H5F_libver_t *high_bound)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(low_bound);
HDassert(high_bound);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.fapl_id);
@@ -2690,14 +2733,14 @@ done:
herr_t
H5CX_get_dset_min_ohdr_flag(hbool_t *dset_min_ohdr_flag)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(dset_min_ohdr_flag);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
@@ -2726,14 +2769,14 @@ done:
herr_t
H5CX_get_ext_file_prefix(const char **extfile_prefix)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(extfile_prefix);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
@@ -2784,14 +2827,14 @@ done:
herr_t
H5CX_get_vds_prefix(const char **vds_prefix)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vds_prefix);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dapl_id);
@@ -2842,12 +2885,12 @@ done:
void
H5CX_set_tag(haddr_t tag)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.tag = tag;
@@ -2870,12 +2913,12 @@ H5CX_set_tag(haddr_t tag)
void
H5CX_set_ring(H5AC_ring_t ring)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.ring = ring;
@@ -2900,12 +2943,12 @@ H5CX_set_ring(H5AC_ring_t ring)
void
H5CX_set_coll_metadata_read(hbool_t cmdr)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.coll_metadata_read = cmdr;
@@ -2930,14 +2973,14 @@ H5CX_set_coll_metadata_read(hbool_t cmdr)
herr_t
H5CX_set_mpi_coll_datatypes(MPI_Datatype btype, MPI_Datatype ftype)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context values */
@@ -2963,13 +3006,13 @@ done:
herr_t
H5CX_set_io_xfer_mode(H5FD_mpio_xfer_t io_xfer_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -2997,13 +3040,13 @@ done:
herr_t
H5CX_set_mpio_coll_opt(H5FD_mpio_collective_opt_t mpio_coll_opt)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -3031,12 +3074,12 @@ done:
void
H5CX_set_mpi_file_flushing(hbool_t flushing)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.mpi_file_flushing = flushing;
@@ -3060,12 +3103,12 @@ H5CX_set_mpi_file_flushing(hbool_t flushing)
void
H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
(*head)->ctx.rank0_bcast = rank0_bcast;
@@ -3089,13 +3132,13 @@ H5CX_set_mpio_rank0_bcast(hbool_t rank0_bcast)
herr_t
H5CX_set_vlen_alloc_info(H5MM_allocate_t alloc_func, void *alloc_info, H5MM_free_t free_func, void *free_info)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -3126,13 +3169,13 @@ done:
herr_t
H5CX_set_nlinks(size_t nlinks)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Set the API context value */
@@ -3162,12 +3205,12 @@ done:
void
H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chunk_opt)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3193,12 +3236,12 @@ H5CX_set_mpio_actual_chunk_opt(H5D_mpio_actual_chunk_opt_mode_t mpio_actual_chun
void
H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3224,12 +3267,12 @@ H5CX_set_mpio_actual_io_mode(H5D_mpio_actual_io_mode_t mpio_actual_io_mode)
void
H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT);
@@ -3258,12 +3301,12 @@ H5CX_set_mpio_local_no_coll_cause(uint32_t mpio_local_no_coll_cause)
void
H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
FUNC_ENTER_NOAPI_NOINIT_NOERR
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert((*head)->ctx.dxpl_id != H5P_DEFAULT);
@@ -3296,13 +3339,13 @@ H5CX_set_mpio_global_no_coll_cause(uint32_t mpio_global_no_coll_cause)
herr_t
H5CX_test_set_mpio_coll_chunk_link_hard(int mpio_coll_chunk_link_hard)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3329,13 +3372,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_hard(int mpio_coll_chunk_multi_hard)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3362,13 +3405,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_link_num_true(int mpio_coll_chunk_link_num_true)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3396,13 +3439,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_link_num_false(int mpio_coll_chunk_link_num_false)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3430,13 +3473,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_ratio_coll(int mpio_coll_chunk_multi_ratio_coll)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3464,13 +3507,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_chunk_multi_ratio_ind(int mpio_coll_chunk_multi_ratio_ind)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3497,13 +3540,13 @@ done:
herr_t
H5CX_test_set_mpio_coll_rank0_bcast(hbool_t mpio_coll_rank0_bcast)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_NOINIT
/* Sanity checks */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(!((*head)->ctx.dxpl_id == H5P_DEFAULT || (*head)->ctx.dxpl_id == H5P_DATASET_XFER_DEFAULT));
@@ -3530,14 +3573,14 @@ done:
herr_t
H5CX_get_ohdr_flags(uint8_t *ohdr_flags)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(ohdr_flags);
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
HDassert(H5P_DEFAULT != (*head)->ctx.dcpl_id);
@@ -3565,9 +3608,8 @@ done:
static H5CX_node_t *
H5CX__pop_common(hbool_t update_dxpl_props)
{
- H5CX_node_t **head =
- H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
- H5CX_node_t *ret_value = NULL; /* Return value */
+ H5CX_node_t **head = NULL; /* Pointer to head of API context list */
+ H5CX_node_t * ret_value = NULL; /* Return value */
#ifdef H5_HAVE_PARALLEL
FUNC_ENTER_STATIC
@@ -3576,6 +3618,7 @@ H5CX__pop_common(hbool_t update_dxpl_props)
#endif
/* Sanity check */
+ head = H5CX_get_my_context(); /* Get the pointer to the head of the API context, for this thread */
HDassert(head && *head);
/* Check for cached DXPL properties to return to application */
diff --git a/src/H5D.c b/src/H5D.c
index ed97bff..7153c7d 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)
diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c
index 5fc7abb..cd54c3a 100644
--- a/src/H5Dchunk.c
+++ b/src/H5Dchunk.c
@@ -107,9 +107,9 @@
/*#define H5D_CHUNK_DEBUG */
/* Flags for the "edge_chunk_state" field below */
-#define H5D_RDCC_DISABLE_FILTERS 0x01u /* Disable filters on this chunk */
+#define H5D_RDCC_DISABLE_FILTERS 0x01U /* Disable filters on this chunk */
#define H5D_RDCC_NEWLY_DISABLED_FILTERS \
- 0x02u /* Filters have been disabled since \
+ 0x02U /* Filters have been disabled since \
* the last flush */
/******************/
@@ -245,10 +245,10 @@ typedef struct H5D_chunk_coll_info_t {
} H5D_chunk_coll_info_t;
#endif /* H5_HAVE_PARALLEL */
-typedef struct H5D_chunk_iter_cb_data_t {
- H5D_chunk_iter_op_t cb; /* User defined callback */
+typedef struct H5D_chunk_iter_ud_t {
+ H5D_chunk_iter_op_t op; /* User defined callback */
void * op_data; /* User data for user defined callback */
-} H5D_chunk_iter_cb_data_t;
+} H5D_chunk_iter_ud_t;
/********************/
/* Local Prototypes */
@@ -1403,6 +1403,19 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline)
} /* H5D__chunk_mem_xfree() */
/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_mem_free
+ *
+ * Purpose: Wrapper with H5MM_free_t-compatible signature that just
+ * calls H5D__chunk_mem_xfree and discards the return value.
+ *-------------------------------------------------------------------------
+ */
+static void
+H5D__chunk_mem_free(void *chk, const void *_pline)
+{
+ (void)H5D__chunk_mem_xfree(chk, _pline);
+}
+
+/*-------------------------------------------------------------------------
* Function: H5D__chunk_mem_realloc
*
* Purpose: Reallocate space for a chunk in memory. This routine allocates
@@ -3193,11 +3206,14 @@ H5D__chunk_hash_val(const H5D_shared_t *shared, const hsize_t *scaled)
herr_t
H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udata)
{
- H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
- H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
- unsigned idx = 0; /* Index of chunk in cache, if present */
- hbool_t found = FALSE; /* In cache? */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_rdcc_ent_t * ent = NULL; /* Cache entry */
+ H5O_storage_chunk_t *sc = &(dset->shared->layout.storage.u.chunk);
+ unsigned idx = 0; /* Index of chunk in cache, if present */
+ hbool_t found = FALSE; /* In cache? */
+#ifdef H5_HAVE_PARALLEL
+ hbool_t reenable_coll_md_reads = FALSE;
+#endif
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -3268,8 +3284,13 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat
* highly unlikely that users would read the same chunks from all
* processes.
*/
- if (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI))
- H5CX_set_coll_metadata_read(FALSE);
+ if (H5F_HAS_FEATURE(idx_info.f, H5FD_FEAT_HAS_MPI)) {
+ hbool_t do_coll_md_reads = H5CX_get_coll_metadata_read();
+ if (do_coll_md_reads) {
+ H5CX_set_coll_metadata_read(FALSE);
+ reenable_coll_md_reads = TRUE;
+ }
+ }
#endif /* H5_HAVE_PARALLEL */
/* Go get the chunk information */
@@ -3312,6 +3333,12 @@ H5D__chunk_lookup(const H5D_t *dset, const hsize_t *scaled, H5D_chunk_ud_t *udat
} /* end else */
done:
+#ifdef H5_HAVE_PARALLEL
+ /* Re-enable collective metadata reads if we disabled them */
+ if (reenable_coll_md_reads)
+ H5CX_set_coll_metadata_read(TRUE);
+#endif /* H5_HAVE_PARALLEL */
+
FUNC_LEAVE_NOAPI(ret_value)
} /* H5D__chunk_lookup() */
@@ -4427,7 +4454,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, const
/* (delay allocating fill buffer for VL datatypes until refilling) */
/* (casting away const OK - QAK) */
if (H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, (void *)pline,
- (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline, &dset->shared->dcpl_cache.fill,
+ (H5MM_free_t)H5D__chunk_mem_free, (void *)pline, &dset->shared->dcpl_cache.fill,
dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info")
fb_info_init = TRUE;
@@ -7515,14 +7542,15 @@ done:
static int
H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)
{
- int ret_value = 0;
+ const H5D_chunk_iter_ud_t *data = (H5D_chunk_iter_ud_t *)udata;
+ int ret_value = H5_ITER_CONT;
FUNC_ENTER_STATIC_NOERR
- const H5D_chunk_iter_cb_data_t *data = (H5D_chunk_iter_cb_data_t *)udata;
-
- ret_value = (data->cb)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr,
- chunk_rec->nbytes, data->op_data);
+ /* Check for callback failure and pass along return value */
+ if ((ret_value = (data->op)(chunk_rec->scaled, chunk_rec->filter_mask, chunk_rec->chunk_addr,
+ chunk_rec->nbytes, data->op_data)) < 0)
+ HERROR(H5E_DATASET, H5E_CANTNEXT, "iteration operator failed");
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5D__chunk_iter_cb */
@@ -7541,7 +7569,7 @@ H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)
*-------------------------------------------------------------------------
*/
herr_t
-H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data)
+H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t op, void *op_data)
{
const H5O_layout_t *layout = NULL; /* Dataset layout */
const H5D_rdcc_t * rdcc = NULL; /* Raw data chunk cache */
@@ -7576,15 +7604,65 @@ H5D__chunk_iter(const H5D_t *dset, H5D_chunk_iter_op_t cb, void *op_data)
/* If the dataset is not written, return without errors */
if (H5F_addr_defined(idx_info.storage->idx_addr)) {
- H5D_chunk_iter_cb_data_t data;
- data.cb = cb;
- data.op_data = op_data;
+ H5D_chunk_iter_ud_t ud;
+
+ /* Set up info for iteration callback */
+ ud.op = op;
+ ud.op_data = op_data;
/* Iterate over the allocated chunks calling the iterator callback */
- if ((dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_iter_cb, &data) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to iterate over chunks.")
+ if ((ret_value =
+ (dset->shared->layout.storage.u.chunk.ops->iterate)(&idx_info, H5D__chunk_iter_cb, &ud)) < 0)
+ HERROR(H5E_DATASET, H5E_CANTNEXT, "chunk iteration failed");
} /* end if H5F_addr_defined */
done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
} /* end H5D__chunk_iter() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5D__chunk_get_offset_copy
+ *
+ * Purpose: Copies an offset buffer and performs bounds checks on the
+ * values.
+ *
+ * This helper function ensures that the offset buffer given
+ * by the user is suitable for use with the rest of the library.
+ *
+ * Return: SUCCEED/FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
+{
+ unsigned u;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ HDassert(dset);
+ HDassert(offset);
+ HDassert(offset_copy);
+
+ /* The library's chunking code requires the offset to terminate with a zero.
+ * So transfer the offset array to an internal offset array that we
+ * can properly terminate (handled via the memset call).
+ */
+ HDmemset(offset_copy, 0, H5O_LAYOUT_NDIMS * sizeof(hsize_t));
+
+ for (u = 0; u < dset->shared->ndims; u++) {
+ /* Make sure the offset doesn't exceed the dataset's dimensions */
+ if (offset[u] > dset->shared->curr_dims[u])
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset exceeds dimensions of dataset")
+
+ /* Make sure the offset fall right on a chunk's boundary */
+ if (offset[u] % dset->shared->layout.u.chunk.dim[u])
+ HGOTO_ERROR(H5E_DATASET, H5E_BADVALUE, FAIL, "offset doesn't fall on chunks's boundary")
+
+ offset_copy[u] = offset[u];
+ }
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5D__chunk_get_offset_copy() */
diff --git a/src/H5Ddeprec.c b/src/H5Ddeprec.c
index 1c66f26..61ecab26 100644
--- a/src/H5Ddeprec.c
+++ b/src/H5Ddeprec.c
@@ -233,13 +233,15 @@ done:
herr_t
H5Dextend(hid_t dset_id, const hsize_t size[])
{
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
- hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
- H5S_t * ds = NULL; /* Dataspace struct */
- int ndims; /* Dataset/space rank */
- hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
- int i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_dataset_get_args_t vol_get_cb_args; /* Arguments to VOL callback */
+ H5VL_dataset_specific_args_t vol_spec_cb_args; /* Arguments to VOL callback */
+ hid_t sid = H5I_INVALID_HID; /* Dataspace ID */
+ H5S_t * ds = NULL; /* Dataspace struct */
+ int ndims; /* Dataset/space rank */
+ hsize_t dset_dims[H5S_MAX_RANK]; /* Current dataset dimensions */
+ int i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*h", dset_id, size);
@@ -250,10 +252,14 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
if (!size)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no size specified")
+ /* Set up VOL callback arguments */
+ vol_get_cb_args.op_type = H5VL_DATASET_GET_SPACE;
+ vol_get_cb_args.args.get_space.space_id = H5I_INVALID_HID;
+
/* Get the dataspace pointer for the dataset */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &sid) <
- 0)
+ if (H5VL_dataset_get(vol_obj, &vol_get_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "unable to get dataspace")
+ sid = vol_get_cb_args.args.get_space.space_id;
if (H5I_INVALID_HID == sid)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "received an invalid dataspace from the dataset")
if (NULL == (ds = (H5S_t *)H5I_object_verify(sid, H5I_DATASPACE)))
@@ -281,9 +287,12 @@ H5Dextend(hid_t dset_id, const hsize_t size[])
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_spec_cb_args.op_type = H5VL_DATASET_SET_EXTENT;
+ vol_spec_cb_args.args.set_extent.size = dset_dims;
+
/* Increase size */
- if ((ret_value = H5VL_dataset_specific(vol_obj, H5VL_DATASET_SET_EXTENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, dset_dims)) < 0)
+ if (H5VL_dataset_specific(vol_obj, &vol_spec_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to extend dataset")
done:
diff --git a/src/H5Dint.c b/src/H5Dint.c
index 5e709db..a287ae8 100644
--- a/src/H5Dint.c
+++ b/src/H5Dint.c
@@ -2853,13 +2853,14 @@ H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id
{
H5D_vlen_bufsize_generic_t vlen_bufsize = {
NULL, H5I_INVALID_HID, NULL, H5I_INVALID_HID, H5I_INVALID_HID, {NULL, NULL, 0, 0}};
- H5P_genplist_t * dxpl = NULL; /* DXPL for operation */
- H5S_t * mspace = NULL; /* Memory dataspace */
- char bogus; /* Bogus value to pass to H5Diterate() */
- H5S_t * space; /* Dataspace for iteration */
- H5T_t * type; /* Datatype */
- H5S_sel_iter_op_t dset_op; /* Operator for iteration */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5P_genplist_t * dxpl = NULL; /* DXPL for operation */
+ H5S_t * mspace = NULL; /* Memory dataspace */
+ char bogus; /* Bogus value to pass to H5Diterate() */
+ H5S_t * space; /* Dataspace for iteration */
+ H5T_t * type; /* Datatype */
+ H5S_sel_iter_op_t dset_op; /* Operator for iteration */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -2874,10 +2875,14 @@ H5D__vlen_get_buf_size_gen(H5VL_object_t *vol_obj, hid_t type_id, hid_t space_id
/* Save the dataset */
vlen_bufsize.dset_vol_obj = vol_obj;
+ /* 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 a copy of the dataset's dataspace */
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &vlen_bufsize.fspace_id) < 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, "can't get dataspace")
+ vlen_bufsize.fspace_id = vol_cb_args.args.get_space.space_id;
if (NULL == (vlen_bufsize.fspace = (H5S_t *)H5I_object(vlen_bufsize.fspace_id)))
HGOTO_ERROR(H5E_DATASET, H5E_BADTYPE, FAIL, "not a dataspace")
@@ -3943,7 +3948,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5D__refresh(hid_t dset_id, H5D_t *dset)
+H5D__refresh(H5D_t *dset, hid_t dset_id)
{
H5D_virtual_held_file_t *head = NULL; /* Pointer to list of files held open */
hbool_t virt_dsets_held = FALSE; /* Whether virtual datasets' files are held open */
@@ -3968,7 +3973,7 @@ H5D__refresh(hid_t dset_id, H5D_t *dset)
} /* end if */
/* Refresh dataset object */
- if ((H5O_refresh_metadata(dset_id, dset->oloc)) < 0)
+ if ((H5O_refresh_metadata(&dset->oloc, dset_id)) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh dataset")
done:
diff --git a/src/H5Dio.c b/src/H5Dio.c
index 03400cf..d1861c4 100644
--- a/src/H5Dio.c
+++ b/src/H5Dio.c
@@ -69,55 +69,6 @@ H5FL_BLK_DEFINE(type_conv);
H5FL_DEFINE(H5D_chunk_map_t);
/*-------------------------------------------------------------------------
- * Function: H5D__get_offset_copy
- *
- * Purpose: Copies an offset buffer and performs bounds checks on the
- * values.
- *
- * This helper function ensures that the offset buffer given
- * by the user is suitable for use with the rest of the library.
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy)
-{
- unsigned u;
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_NOAPI(FAIL)
-
- HDassert(dset);
- HDassert(offset);
- HDassert(offset_copy);
-
- /* The library's chunking code requires the offset to terminate with a zero.
- * So transfer the offset array to an internal offset array that we
- * can properly terminate (handled via the calloc call).
- */
-
- HDmemset(offset_copy, 0, H5O_LAYOUT_NDIMS * sizeof(hsize_t));
-
- for (u = 0; u < dset->shared->ndims; u++) {
- /* Make sure the offset doesn't exceed the dataset's dimensions */
- if (offset[u] > dset->shared->curr_dims[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset exceeds dimensions of dataset")
-
- /* Make sure the offset fall right on a chunk's boundary */
- if (offset[u] % dset->shared->layout.u.chunk.dim[u])
- HGOTO_ERROR(H5E_DATASPACE, H5E_BADTYPE, FAIL, "offset doesn't fall on chunks's boundary")
-
- offset_copy[u] = offset[u];
- }
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-
-} /* end H5D__get_offset_copy() */
-
-/*-------------------------------------------------------------------------
* Function: H5D__read
*
* Purpose: Reads (part of) a DATASET into application memory BUF. See
@@ -161,12 +112,8 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
/* check args */
HDassert(dataset && dataset->oloc.file);
-
- if (!file_space)
- file_space = dataset->shared->space;
- if (!mem_space)
- mem_space = file_space;
- nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
+ HDassert(file_space);
+ HDassert(mem_space);
/* Set up datatype info for operation */
if (H5D__typeinfo_init(dataset, mem_type_id, FALSE, &type_info) < 0)
@@ -189,11 +136,12 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
#endif /*H5_HAVE_PARALLEL*/
/* Make certain that the number of elements in each selection is the same */
+ nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
if (nelmts != H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest dataspaces have different number of elements selected")
- /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
+ /* Check for a NULL buffer */
if (NULL == buf) {
/* Check for any elements selected (which is invalid) */
if (nelmts > 0)
@@ -225,7 +173,7 @@ H5D__read(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_t
* Note that in general, this requires us to touch up the memory buffer as
* well.
*/
- if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
+ if (nelmts > 0 && TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
/* to the beginning of the projected mem space. */
@@ -377,6 +325,8 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_
/* check args */
HDassert(dataset && dataset->oloc.file);
+ HDassert(file_space);
+ HDassert(mem_space);
/* All filters in the DCPL must have encoding enabled. */
if (!dataset->shared->checked_filters) {
@@ -418,20 +368,13 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_
} /* end else */
#endif /*H5_HAVE_PARALLEL*/
- /* Initialize dataspace information */
- if (!file_space)
- file_space = dataset->shared->space;
- if (!mem_space)
- mem_space = file_space;
-
- nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
-
/* Make certain that the number of elements in each selection is the same */
+ nelmts = H5S_GET_SELECT_NPOINTS(mem_space);
if (nelmts != H5S_GET_SELECT_NPOINTS(file_space))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL,
"src and dest dataspaces have different number of elements selected")
- /* Check for a NULL buffer, after the H5S_ALL dataspace selection has been handled */
+ /* Check for a NULL buffer */
if (NULL == buf) {
/* Check for any elements selected (which is invalid) */
if (nelmts > 0)
@@ -463,7 +406,7 @@ H5D__write(H5D_t *dataset, hid_t mem_type_id, const H5S_t *mem_space, const H5S_
* Note that in general, this requires us to touch up the memory buffer
* as well.
*/
- if (TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
+ if (nelmts > 0 && TRUE == H5S_SELECT_SHAPE_SAME(mem_space, file_space) &&
H5S_GET_EXTENT_NDIMS(mem_space) != H5S_GET_EXTENT_NDIMS(file_space)) {
const void *adj_buf = NULL; /* Pointer to the location in buf corresponding */
/* to the beginning of the projected mem space. */
@@ -867,11 +810,19 @@ H5D__ioinfo_adjust(H5D_io_info_t *io_info, const H5D_t *dset, const H5S_t *file_
io_info->io_ops.single_write = H5D__mpio_select_write;
} /* end if */
else {
+ int comm_size = 0;
+
+ /* Retrieve size of MPI communicator used for file */
+ if ((comm_size = H5F_shared_mpi_get_size(io_info->f_sh)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get MPI communicator size")
+
/* Check if there are any filters in the pipeline. If there are,
- * we cannot break to independent I/O if this is a write operation;
- * otherwise there will be metadata inconsistencies in the file.
+ * we cannot break to independent I/O if this is a write operation
+ * with multiple ranks involved; otherwise, there will be metadata
+ * inconsistencies in the file.
*/
- if (io_info->op_type == H5D_IO_OP_WRITE && io_info->dset->shared->dcpl_cache.pline.nused > 0) {
+ if (comm_size > 1 && io_info->op_type == H5D_IO_OP_WRITE &&
+ io_info->dset->shared->dcpl_cache.pline.nused > 0) {
H5D_mpio_no_collective_cause_t cause;
uint32_t local_no_collective_cause;
uint32_t global_no_collective_cause;
diff --git a/src/H5Dmodule.h b/src/H5Dmodule.h
index 595c714..596fd48 100644
--- a/src/H5Dmodule.h
+++ b/src/H5Dmodule.h
@@ -44,18 +44,18 @@
* <tr><th>Create</th><th>Read</th></tr>
* <tr valign="top">
* <td>
- * \snippet H5D_examples.c create
+ * \snippet{lineno} H5D_examples.c create
* </td>
* <td>
- * \snippet H5D_examples.c read
+ * \snippet{lineno} H5D_examples.c read
* </td>
* <tr><th>Update</th><th>Delete</th></tr>
* <tr valign="top">
* <td>
- * \snippet H5D_examples.c update
+ * \snippet{lineno} H5D_examples.c update
* </td>
* <td>
- * \snippet H5D_examples.c delete
+ * \snippet{lineno} H5D_examples.c delete
* </td>
* </tr>
* </table>
diff --git a/src/H5Dpkg.h b/src/H5Dpkg.h
index 972a67b..92ea120 100644
--- a/src/H5Dpkg.h
+++ b/src/H5Dpkg.h
@@ -576,7 +576,7 @@ H5_DLL herr_t H5D__flush_sieve_buf(H5D_t *dataset);
H5_DLL herr_t H5D__flush_real(H5D_t *dataset);
H5_DLL herr_t H5D__flush(H5D_t *dset, hid_t dset_id);
H5_DLL herr_t H5D__mark(const H5D_t *dataset, unsigned flags);
-H5_DLL herr_t H5D__refresh(hid_t dset_id, H5D_t *dataset);
+H5_DLL herr_t H5D__refresh(H5D_t *dataset, hid_t dset_id);
/* To convert a dataset's chunk indexing type to v1 B-tree */
H5_DLL herr_t H5D__format_convert(H5D_t *dataset);
@@ -651,7 +651,7 @@ H5_DLL herr_t H5D__chunk_copy(H5F_t *f_src, H5O_storage_chunk_t *storage_src, H5
H5_DLL herr_t H5D__chunk_bh_info(const H5O_loc_t *loc, H5O_t *oh, H5O_layout_t *layout, hsize_t *btree_size);
H5_DLL herr_t H5D__chunk_dump_index(H5D_t *dset, FILE *stream);
H5_DLL herr_t H5D__chunk_delete(H5F_t *f, H5O_t *oh, H5O_storage_t *store);
-H5_DLL herr_t H5D__get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy);
+H5_DLL herr_t H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *offset_copy);
H5_DLL herr_t H5D__chunk_direct_write(const H5D_t *dset, uint32_t filters, hsize_t *offset,
uint32_t data_size, const void *buf);
H5_DLL herr_t H5D__chunk_direct_read(const H5D_t *dset, hsize_t *offset, uint32_t *filters, void *buf);
diff --git a/src/H5Dpublic.h b/src/H5Dpublic.h
index 0b5fac6..c496414 100644
--- a/src/H5Dpublic.h
+++ b/src/H5Dpublic.h
@@ -32,7 +32,9 @@
#define H5D_CHUNK_CACHE_NBYTES_DEFAULT SIZE_MAX
#define H5D_CHUNK_CACHE_W0_DEFAULT (-1.0)
-/* Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts() */
+/**
+ * Bit flags for the H5Pset_chunk_opts() and H5Pget_chunk_opts()
+ */
#define H5D_CHUNK_DONT_FILTER_PARTIAL_CHUNKS (0x0002u)
/*******************/
@@ -44,13 +46,12 @@
* Values for the H5D_LAYOUT property
*/
typedef enum H5D_layout_t {
- H5D_LAYOUT_ERROR = -1,
-
- H5D_COMPACT = 0, /**< raw data is very small */
- H5D_CONTIGUOUS = 1, /**< the default */
- H5D_CHUNKED = 2, /**< slow and fancy */
- H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */
- H5D_NLAYOUTS = 4 /**< this one must be last! */
+ H5D_LAYOUT_ERROR = -1, /**< error */
+ H5D_COMPACT = 0, /**< raw data is small (< 64KB) */
+ H5D_CONTIGUOUS = 1, /**< contiguous layout */
+ H5D_CHUNKED = 2, /**< chunked or tiled layout */
+ H5D_VIRTUAL = 3, /**< actual data is stored in other datasets */
+ H5D_NLAYOUTS = 4 /**< this one must be last! */
} H5D_layout_t;
//! <!-- [H5D_layout_t_snip] -->
@@ -75,11 +76,11 @@ typedef enum H5D_chunk_index_t {
* Values for the space allocation time property
*/
typedef enum H5D_alloc_time_t {
- H5D_ALLOC_TIME_ERROR = -1,
- H5D_ALLOC_TIME_DEFAULT = 0,
- H5D_ALLOC_TIME_EARLY = 1,
- H5D_ALLOC_TIME_LATE = 2,
- H5D_ALLOC_TIME_INCR = 3
+ H5D_ALLOC_TIME_ERROR = -1, /**< Error */
+ H5D_ALLOC_TIME_DEFAULT = 0, /**< \todo Define this! */
+ H5D_ALLOC_TIME_EARLY = 1, /**< Allocate on creation */
+ H5D_ALLOC_TIME_LATE = 2, /**< Allocate on first write */
+ H5D_ALLOC_TIME_INCR = 3 /**< Allocate incrementally (by chunk) */
} H5D_alloc_time_t;
//! <!-- [H5D_alloc_time_t_snip] -->
@@ -88,10 +89,11 @@ typedef enum H5D_alloc_time_t {
* Values for the status of space allocation
*/
typedef enum H5D_space_status_t {
- H5D_SPACE_STATUS_ERROR = -1,
- H5D_SPACE_STATUS_NOT_ALLOCATED = 0,
- H5D_SPACE_STATUS_PART_ALLOCATED = 1,
- H5D_SPACE_STATUS_ALLOCATED = 2
+ H5D_SPACE_STATUS_ERROR = -1, /**< Error */
+ H5D_SPACE_STATUS_NOT_ALLOCATED = 0, /**< Space has not been allocated for this dataset. */
+ H5D_SPACE_STATUS_PART_ALLOCATED = 1, /**< Space has been allocated for this dataset. */
+ H5D_SPACE_STATUS_ALLOCATED = 2 /**< Space has been partially allocated for this dataset. (Used only for
+ datasets with chunked storage.) */
} H5D_space_status_t;
//! <!-- [H5D_space_status_t_snip] -->
@@ -100,10 +102,10 @@ typedef enum H5D_space_status_t {
* Values for time of writing fill value property
*/
typedef enum H5D_fill_time_t {
- H5D_FILL_TIME_ERROR = -1,
- H5D_FILL_TIME_ALLOC = 0,
- H5D_FILL_TIME_NEVER = 1,
- H5D_FILL_TIME_IFSET = 2
+ H5D_FILL_TIME_ERROR = -1, /**< Error */
+ H5D_FILL_TIME_ALLOC = 0, /**< Fill on allocation */
+ H5D_FILL_TIME_NEVER = 1, /**< Never write fill values */
+ H5D_FILL_TIME_IFSET = 2 /**< Fill if fill-value was set */
} H5D_fill_time_t;
//! <!-- [H5D_fill_time_t_snip] -->
@@ -112,10 +114,10 @@ typedef enum H5D_fill_time_t {
* Values for fill value status
*/
typedef enum H5D_fill_value_t {
- H5D_FILL_VALUE_ERROR = -1,
- H5D_FILL_VALUE_UNDEFINED = 0,
- H5D_FILL_VALUE_DEFAULT = 1,
- H5D_FILL_VALUE_USER_DEFINED = 2
+ H5D_FILL_VALUE_ERROR = -1, /**< Error */
+ H5D_FILL_VALUE_UNDEFINED = 0, /**< No fill value defined */
+ H5D_FILL_VALUE_DEFAULT = 1, /**< Default fill-value */
+ H5D_FILL_VALUE_USER_DEFINED = 2 /**< User-defined fill-value */
} H5D_fill_value_t;
//! <!-- [H5D_fill_value_t_snip] -->
@@ -124,22 +126,40 @@ typedef enum H5D_fill_value_t {
* Values for VDS bounds option
*/
typedef enum H5D_vds_view_t {
- H5D_VDS_ERROR = -1,
- H5D_VDS_FIRST_MISSING = 0,
- H5D_VDS_LAST_AVAILABLE = 1
+ H5D_VDS_ERROR = -1, /**< Error */
+ H5D_VDS_FIRST_MISSING = 0, /**< \todo Define this! */
+ H5D_VDS_LAST_AVAILABLE = 1 /**< \todo Define this! */
} H5D_vds_view_t;
//! <!-- [H5D_vds_view_t_snip] -->
//! <!-- [H5D_append_cb_t_snip] -->
/**
- * Callback for H5Pset_append_flush() in a dataset access property list
+ * \brief Callback for H5Pset_append_flush()
+ *
+ * \dset_id{dataset_id}
+ * \param[in] cur_dims The current extent of the dataset's dimensions
+ * \param[in,out] op_data User context
+ *
+ * \return \herr_t
+ *
*/
typedef herr_t (*H5D_append_cb_t)(hid_t dataset_id, hsize_t *cur_dims, void *op_data);
//! <!-- [H5D_append_cb_t_snip] -->
//! <!-- [H5D_operator_t_snip] -->
/**
- * Define the operator function pointer for H5Diterate()
+ * \brief Callback for H5Diterate()
+ *
+ * \param[in,out] elem Pointer to the memory buffer containing the current dataset
+ * element
+ * \param[in] type_id Datatype identifier of the elements stored in \p elem
+ * \param[in] ndim Number of dimensions for the \p point array
+ * \param[in] point Array containing the location of the element within
+ * the original dataspace
+ * \param[in,out] operator_data Pointer to any user-defined data associated with
+ * the operation
+ * \return \herr_t_iter
+ *
*/
typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const hsize_t *point,
void *operator_data);
@@ -147,7 +167,29 @@ typedef herr_t (*H5D_operator_t)(void *elem, hid_t type_id, unsigned ndim, const
//! <!-- [H5D_scatter_func_t_snip] -->
/**
- * Define the operator function pointer for H5Dscatter()
+ * \brief Callback for H5Dscatter()
+ *
+ * \param[out] src_buf Pointer to the buffer holding the next set of elements to
+ * scatter. On entry, the value of where \p src_buf points to
+ * is undefined. The callback function should set \p src_buf
+ * to point to the next set of elements.
+ * \param[out] src_buf_bytes_used Pointer to the number of valid bytes in \p src_buf.
+ * On entry, the value where \p src_buf_bytes_used points
+ * to is undefined. The callback function should set
+ * \p src_buf_bytes_used to the of valid bytes in \p src_buf.
+ * This number must be a multiple of the datatype size.
+ * \param[in,out] op_data User-defined pointer to data required by the callback
+ * function. A pass-through of the \p op_data pointer provided
+ * with the H5Dscatter() function call.
+ * \return herr_t
+ *
+ * \details The callback function should always return at least one
+ * element in \p src_buf, and must not return more elements
+ * than are remaining to be scattered. This function will be
+ * repeatedly called until all elements to be scattered have
+ * been returned. The callback function should return zero (0)
+ * to indicate success, and a negative value to indicate failure.
+ *
*/
typedef herr_t (*H5D_scatter_func_t)(const void **src_buf /*out*/, size_t *src_buf_bytes_used /*out*/,
void *op_data);
@@ -155,18 +197,51 @@ typedef herr_t (*H5D_scatter_func_t)(const void **src_buf /*out*/, size_t *src_b
//! <!-- [H5D_gather_func_t_snip] -->
/**
- * Define the operator function pointer for H5Dgather()
+ * \brief Callback for H5Dgather()
+ *
+ * \param[in] dst_buf Pointer to the destination buffer which has been filled
+ * with the next set of elements gathered. This will always
+ * be identical to the \p dst_buf passed to H5Dgather()
+ * \param[in] dst_buf_bytes_used Pointer to the number of valid bytes in
+ * \p dst_buf. This number must be a multiple of
+ * the datatype size.
+ * \param[in,out] op_data User-defined pointer to data required by the callback
+ * function; a pass-through of the \p op_data pointer
+ * provided with the H5Dgather() function call.
+ * \returns \herr_t
+ *
+ * \details The callback function should process, store, or otherwise make use
+ * of the data returned in dst_buf before it returns, because the
+ * buffer will be overwritten unless it is the last call to the
+ * callback. This function will be repeatedly called until all gathered
+ * elements have been passed to the callback in dst_buf. The callback
+ * function should return zero (0) to indicate success, and a negative
+ * value to indicate failure.
+ *
*/
typedef herr_t (*H5D_gather_func_t)(const void *dst_buf, size_t dst_buf_bytes_used, void *op_data);
//! <!-- [H5D_gather_func_t_snip] -->
//! <!-- [H5D_chunk_iter_op_t_snip] -->
/**
- * Define the operator function pointer for H5Dchunk_iter()
+ * \brief Callback for H5Dchunk_iter()
+ *
+ * \param[in] offset Array of starting logical coordinates of chunk.
+ * \param[in] filter_mask Filter mask of chunk.
+ * \param[in] addr Offset in file of chunk data.
+ * \param[in] nbytes Size in bytes of chunk data in file.
+ * \param[in,out] op_data Pointer to any user-defined data associated with
+ * the operation.
+ * \returns \li Zero (#H5_ITER_CONT) causes the iterator to continue, returning
+ * zero when all elements have been processed.
+ * \li A positive value (#H5_ITER_STOP) causes the iterator to
+ * immediately return that value, indicating short-circuit success.
+ * \li A negative (#H5_ITER_ERROR) causes the iterator to immediately
+ * return that value, indicating failure.
*/
-//! <!-- [H5D_chunk_iter_op_t_snip] -->
typedef int (*H5D_chunk_iter_op_t)(const hsize_t *offset, uint32_t filter_mask, haddr_t addr, uint32_t nbytes,
void *op_data);
+//! <!-- [H5D_chunk_iter_op_t_snip] -->
/********************/
/* Public Variables */
@@ -186,7 +261,7 @@ extern "C" {
* \brief Creates a new dataset and links it into the file
*
* \fgdta_loc_id
- * \param[in] name Name of the dataset to create
+ * \param[in] name Name of the dataset to create
* \type_id
* \space_id
* \lcpl_id
@@ -211,13 +286,6 @@ extern "C" {
* \p name may be either an absolute path in the file or a relative
* path from \p loc_id naming the dataset.
*
- * \p dtype_id specifies the datatype of each data element as stored
- * in the file. If \p dtype_id is either a fixed-length or
- * variable-length string, it is important to set the string length
- * when defining the datatype. String datatypes are derived from
- * #H5T_C_S1 (or #H5T_FORTRAN_S1 for Fortran codes), which defaults
- * to 1 character in size.
- *
* If \p dtype_id is a committed datatype, and if the file location
* associated with the committed datatype is different from the
* file location where the dataset will be created, the datatype
@@ -225,7 +293,7 @@ extern "C" {
*
* The link creation property list, \p lcpl_id, governs creation
* of the link(s) by which the new dataset is accessed and the
- * creation of any * intermediate groups that may be missing.
+ * creation of any intermediate groups that may be missing.
*
* The datatype and dataspace properties and the dataset creation
* and access property lists are attached to the dataset, so the
@@ -236,8 +304,8 @@ extern "C" {
* not previously written, the HDF5 library will return default
* or user-defined fill values.
*
- * To conserve and release resources, the dataset should be closed
- * when access is no longer required.
+ * \par Example
+ * \snippet H5D_examples.c create
*
* \since 1.8.0
*
@@ -285,34 +353,14 @@ H5_DLL hid_t H5Dcreate_async(const char *app_file, const char *app_func, unsigne
* the file, which may differ from the datatype and dataspace
* in application memory.
*
- * Dataset creation property list and dataset access creation
- * property list are specified by \p dcpl_id and \p dapl_id.
- *
* H5Dcreate_anon() returns a new dataset identifier. Using
* this identifier, the new dataset must be linked into the
* HDF5 file structure with H5Olink() or it will be deleted
- * from the file when the file is closed.
- *
- * See H5Dcreate2() for further details and considerations on
- * the use of H5Dcreate2() and H5Dcreate_anon().
- *
- * The differences between this function and H5Dcreate2() are
- * as follows:
- * \li H5Dcreate_anon() explicitly includes a dataset access property
- * list. H5Dcreate() always uses default dataset access properties.
- *
- * \li H5Dcreate_anon() neither provides the new dataset’s name nor
- * links it into the HDF5 file structure; those actions must be
- * performed separately through a call to H5Olink(), which offers
- * greater control over linking.
- *
- * A dataset created with this function should be closed with
- * H5Dclose() when the dataset is no longer needed so that resource
- * leaks will not develop.
+ * when the file is closed.
*
* \since 1.8.0
*
- * \see H5Olink(), H5Dcreate(), Using Identifiers
+ * \see H5Olink(), H5Dcreate()
*
*/
H5_DLL hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t dcpl_id, hid_t dapl_id);
@@ -338,12 +386,6 @@ H5_DLL hid_t H5Dcreate_anon(hid_t loc_id, hid_t type_id, hid_t space_id, hid_t d
* specified then the dataset will be opened at the location
* where the attribute, dataset, or named datatype is attached.
*
- * The dataset access property list, \p dapl_id, provides
- * information regarding access to the dataset.
- *
- * To conserve and release resources, the dataset should be closed
- * when access is no longer required.
- *
* \since 1.8.0
*
* \see H5Dcreate2(), H5Dclose()
@@ -377,6 +419,9 @@ H5_DLL hid_t H5Dopen_async(const char *app_file, const char *app_func, unsigned
* be released with H5Sclose() when the identifier is no longer
* needed so that resource leaks will not occur.
*
+ * \par Example
+ * \snippet H5D_examples.c update
+ *
* \see H5Sclose()
*
*/
@@ -393,7 +438,19 @@ H5_DLL hid_t H5Dget_space_async(const char *app_file, const char *app_func, unsi
/**
* --------------------------------------------------------------------------
* \ingroup H5D
- * \todo Document this function!
+ *
+ * \brief Determines whether space has been allocated for a dataset
+ *
+ * \dset_id
+ * \param[out] allocation Space allocation status
+ *
+ * \return \herr_t
+ *
+ * \details H5Dget_space_status() determines whether space has been allocated
+ * for the dataset \p dset_id.
+ *
+ * \since 1.6.0
+ *
*/
H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation);
@@ -412,27 +469,7 @@ H5_DLL herr_t H5Dget_space_status(hid_t dset_id, H5D_space_status_t *allocation)
*
* If a dataset has a named datatype, then an identifier to the
* opened datatype is returned. Otherwise, the returned datatype
- * is read-only. If atomization of the datatype fails, then the
- * datatype is closed.
- *
- * A datatype identifier returned from this function should be
- * released with H5Tclose() when the identifier is no longer
- * needed to prevent resource leaks.
- *
- * \note Datatype Identifiers
- *
- * Please note that the datatype identifier is actually an object
- * identifier or a handle returned from opening the datatype. It
- * is not persistent and its value can be different from one HDF5
- * session to the next.
- *
- * H5Tequal() can be used to compare datatypes.
- *
- * HDF5 High Level APIs that may also be of interest are:
- *
- * H5LTdtype_to_text() creates a text description of a
- * datatype. H5LTtext_to_dtype() creates an HDF5 datatype
- * given a text description.
+ * is read-only.
*
*/
H5_DLL hid_t H5Dget_type(hid_t dset_id);
@@ -452,9 +489,6 @@ H5_DLL hid_t H5Dget_type(hid_t dset_id);
* a copy of the dataset creation property list associated with
* the dataset specified by \p dset_id.
*
- * The creation property list identifier should be released
- * with H5Pclose() to prevent resource leaks.
- *
*/
H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
@@ -488,10 +522,6 @@ H5_DLL hid_t H5Dget_create_plist(hid_t dset_id);
* All link access properties in the returned list will be set
* to the default values.
*
- * The access property list identifier should be released with
- * H5Pclose() when the identifier is no longer needed so that
- * resource leaks will not develop.
- *
* \since 1.8.3
*
*/
@@ -510,11 +540,8 @@ H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
* \details H5Dget_storage_size() returns the amount of storage,
* in bytes, that is allocated in the file for the raw data of
* the dataset specified by \p dset_id.
- *
- * \note The amount of storage in this case is the storage
- * allocated in the written file, which will typically differ
- * from the space required to hold a dataset in working memory.
- *
+ * H5Dget_storage_size() reports only the space required to store
+ * the dataset elements, excluding any metadata.
* \li For contiguous datasets, the returned size equals the current
* allocated size of the raw data.
* \li For unfiltered chunked datasets, the returned size is the
@@ -524,21 +551,19 @@ H5_DLL hid_t H5Dget_access_plist(hid_t dset_id);
* compression filter is in use, H5Dget_storage_size() will return
* the total space required to store the compressed chunks.
*
- * H5Dget_storage_size() reports only the space required to store
- * the data, not including that of any metadata.
+ * \note Note that H5Dget_storage_size() is not generally an
+ * appropriate function to use when determining the amount
+ * of memory required to work with a dataset. In such
+ * circumstances, you must determine the number of data
+ * points in a dataset and the size of an individual dataset
+ * element. H5Sget_simple_extent_npoints() and H5Tget_size()
+ * can be used to calculate that amount.
*
- * \attention H5Dget_storage_size() does not differentiate between 0 (zero),
+ * \warning H5Dget_storage_size() does not differentiate between 0 (zero),
* the value returned for the storage size of a dataset
* with no stored values, and 0 (zero), the value returned to
* indicate an error.
*
- * \note Note that H5Dget_storage_size() is not generally an
- * appropriate function to use when determining the amount
- * of memory required to work with a dataset. In such
- * circumstances, you must determine the number of data
- * points in a dataset and the size of an individual data
- * element. H5Sget_simple_extent_npoints() and H5Tget_size()
- * can be used to get that information.
*
*/
H5_DLL hsize_t H5Dget_storage_size(hid_t dset_id);
@@ -595,7 +620,7 @@ H5_DLL herr_t H5Dget_chunk_storage_size(hid_t dset_id, const hsize_t *offset, hs
* effect. Also, the implementation does not handle the #H5S_ALL
* macro correctly. As a workaround, application can get
* the dataspace for the dataset using H5Dget_space() and pass that
- * in for \p fspace_id. This will be fixed in coming releases.
+ * in for \p fspace_id. This will be fixed in a future release.
*
* \since 1.10.5
*
@@ -638,9 +663,10 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u
* --------------------------------------------------------------------------
* \ingroup H5D
*
- * \brief Iterate over all chunks
+ * \brief Iterate over all chunks of a chunked dataset
*
* \dset_id
+ * \param[in] dxpl_id Identifier of a transfer property list
* \param[in] cb User callback function, called for every chunk.
* \param[in] op_data User-defined pointer to data required by op
*
@@ -648,36 +674,19 @@ H5_DLL herr_t H5Dget_chunk_info_by_coord(hid_t dset_id, const hsize_t *offset, u
*
* \details H5Dget_chunk_iter iterates over all chunks in the dataset, calling the
* user supplied callback with the details of the chunk and the supplied
- * \p op_data.
- *
- * Callback information:
- * H5D_chunk_iter_op_t is defined as:
- *
- * typedef int (*H5D_chunk_iter_op_t)(
- * const hsize_t *offset,
- * uint32_t filter_mask,
- * haddr_t addr,
- * uint32_t nbytes,
- * void *op_data);
- *
- * H5D_chunk_iter_op_t parameters:
- * hsize_t *offset; IN/OUT: Array of starting logical coordinates of chunk.
- * uint32_t filter_mask; IN: Filter mask of chunk.
- * haddr_t addr; IN: Offset in file of chunk data.
- * uint32_t nbytes; IN: Size in number of bytes of chunk data in file.
- * void *op_data; IN/OUT: Pointer to any user-defined data
- * associated with the operation.
- *
- * The return values from an operator are:
- * Zero (H5_ITER_CONT) causes the iterator to continue, returning zero when all
- * elements have been processed.
- * Positive (H5_ITER_STOP) causes the iterator to immediately return that positive
- * value, indicating short-circuit success.
- * Negative (H5_ITER_ERROR) causes the iterator to immediately return that value,
- * indicating failure.
+ * context \p op_data.
+ *
+ * \par Example
+ * For each chunk, print the allocated chunk size (0 for un-allocated chunks).
+ * \snippet H5D_examples.c H5Dchunk_iter_cb
+ * Iterate over all chunked datasets and chunks in a file.
+ * \snippet H5D_examples.c H5Ovisit_cb
+ *
+ * \version 1.?.?
+ * \todo When was this function introduced?
*
*/
-H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, H5D_chunk_iter_op_t cb, void *op_data);
+H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, hid_t dxpl_id, H5D_chunk_iter_op_t cb, void *op_data);
/**
* --------------------------------------------------------------------------
@@ -695,16 +704,16 @@ H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, H5D_chunk_iter_op_t cb, void *op_data
*
* \return \herr_t
*
- * \details H5Dget_chunk_info() retrieves the offset coordinates
- * offset, filter mask filter_mask, size size and address addr for
- * the dataset specified by the identifier dset_id and the chunk
- * specified by the index index. The chunk belongs to a set of
- * chunks in the selection specified by fspace_id. If the queried
+ * \details H5Dget_chunk_info() retrieves the offset coordinates,
+ * \p offset, filter mask, \p filter_mask, size, \p size, and address
+ * \p addr for the dataset specified by the identifier \p dset_id and the chunk
+ * specified by the index \p index. The chunk belongs to a set of
+ * chunks in the selection specified by \p fspace_id. If the queried
* chunk does not exist in the file, the size will be set to 0 and
- * address to \c HADDR_UNDEF. The value pointed to by filter_mask will
- * not be modified. NULL can be passed in for any \p out parameters.
+ * address to #HADDR_UNDEF. The value pointed to by filter_mask will
+ * not be modified. \c NULL can be passed in for any \p out parameters.
*
- * \p chk_idx is the chunk index in the selection. Index value
+ * \p chk_idx is the chunk index in the selection. The index value
* may have a value of 0 up to the number of chunks stored in
* the file that have a nonempty intersection with the file
* dataspace selection
@@ -718,9 +727,9 @@ H5_DLL herr_t H5Dchunk_iter(hid_t dset_id, H5D_chunk_iter_op_t cb, void *op_data
* \note Please be aware that this function currently does not
* support non-trivial selections, thus \p fspace_id has no
* effect. Also, the implementation does not handle the #H5S_ALL
- * macro correctly. As a workaround, application can get
+ * macro correctly. As a workaround, an application can get
* the dataspace for the dataset using H5Dget_space() and pass that
- * in for \p fspace_id. This will be fixed in coming releases.
+ * in for \p fspace_id. This will be fixed in a future release.
*
* \since 1.10.5
*
@@ -736,7 +745,7 @@ H5_DLL herr_t H5Dget_chunk_info(hid_t dset_id, hid_t fspace_id, hsize_t chk_idx,
*
* \dset_id
*
- * \return Returns the offset in bytes; otherwise, returns \c HADDR_UNDEF,
+ * \return Returns the offset in bytes; otherwise, returns #HADDR_UNDEF,
* a negative value.
*
* \details H5Dget_offset() returns the address in the file of
@@ -785,9 +794,8 @@ H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
* used for the memory dataspace and the selection defined with \p
* file_space_id is used for the selection within that dataspace.
*
- * If raw data storage space has not been allocated for the dataset
- * and a fill value has been defined, the returned buffer \p buf
- * is filled with the fill value.
+ * The number of elements selected in the memory dataspace \Emph{must}
+ * be equal to the number of elements selected in the file dataspace.
*
* The behavior of the library for the various combinations of
* valid dataspace identifiers and #H5S_ALL for the \p mem_space_id
@@ -832,14 +840,12 @@ H5_DLL haddr_t H5Dget_offset(hid_t dset_id);
* </tr>
* </table>
*
- * \details Setting an #H5S_ALL selection indicates that the entire
- * dataspace, as defined by the current dimensions of a dataspace,
- * will be selected. The number of elements selected in the memory
- * dataspace must match the number of elements selected in the
- * file dataspace.
+ * \note If no storage space was allocated for the dataset
+ * and a fill value is defined, the returned buffer \p buf
+ * is filled with the fill value.
*
- * \p dxpl_id can be the constant #H5P_DEFAULT, in which case the
- * default data transfer properties are used.
+ * \par Example
+ * \snippet H5D_examples.c read
*
*/
H5_DLL herr_t H5Dread(hid_t dset_id, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id,
@@ -952,6 +958,8 @@ H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned
* time if the dataset's fill time is set to #H5D_FILL_TIME_IFSET
* or #H5D_FILL_TIME_ALLOC.
*
+ * \par_compr_note
+ *
* \attention If a dataset's storage layout is 'compact', care must be
* taken when writing data to the dataset in parallel. A compact
* dataset's raw data is cached in memory and may be flushed
@@ -959,6 +967,9 @@ H5_DLL herr_t H5Dread_async(const char *app_file, const char *app_func, unsigned
* applications should always attempt to write identical data to
* the dataset from all processes.
*
+ * \par Example
+ * \snippet H5D_examples.c update
+ *
* \see H5Pset_fill_time(), H5Pset_alloc_time()
*
*/
@@ -999,11 +1010,6 @@ H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigne
* pipeline, including filters, and will be written directly to
* the file. Only one chunk can be written with this function.
*
- * H5Dwrite_chunk() replaces the now deprecated H5DOwrite_chunk()
- * function, which was located in the high level optimization
- * library. The parameters and behavior are identical to the
- * original.
- *
* \p filters is a mask providing a record of which filters are
* used with the the chunk. The default value of the mask is
* zero (0), indicating that all enabled filters are applied. A
@@ -1031,11 +1037,10 @@ H5_DLL herr_t H5Dwrite_async(const char *app_file, const char *app_func, unsigne
* in a file. H5Dwrite_chunk() bypasses hyperslab selection, the
* conversion of data from one datatype to another, and the filter
* pipeline to write the chunk. Developers should have experience
- * with these processes before using this function. Please see
- * Using the Direct Chunk Write Function for more information.
+ * with these processes before using this function.
*
- * \note H5Dread_chunk() and H5Dwrite_chunk() are not supported under
- * parallel and do not support variable length types.
+ * \note H5Dread_chunk() and H5Dwrite_chunk() are currently not supported
+ * with parallel HDF5 and do not support variable-length types.
*
* \since 1.10.2
*
@@ -1073,10 +1078,10 @@ H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, con
* the dimension limits and must specify a point that falls on
* a dataset chunk boundary.
*
- * The mask \p filters indicates which filters are used with the
- * chunk when written. A zero value indicates that all enabled
- * filters are applied on the chunk. A filter is skipped if the
- * bit corresponding to the filter’s position in the pipeline
+ * The mask \p filters indicates which filters were used when the
+ * chunk was written. A zero value (all bits 0) indicates that all
+ * enabled filters are applied on the chunk. A filter is skipped if
+ * the bit corresponding to the filter’s position in the pipeline
* (0 ≤ position < 32) is turned on.
*
* \p buf is the memory buffer containing the chunk read from
@@ -1090,8 +1095,8 @@ H5_DLL herr_t H5Dwrite_chunk(hid_t dset_id, hid_t dxpl_id, uint32_t filters, con
* with these processes before using this function. Please see
* Using the Direct Chunk Write Function for more information.
*
- * \note H5Dread_chunk() and H5Dwrite_chunk() are not supported under
- * parallel and do not support variable length types.
+ * \note H5Dread_chunk() and H5Dwrite_chunk() are currently not supported
+ * with parallel HDF5 and do not support variable-length datatypes.
*
* \since 1.10.2
*
@@ -1121,52 +1126,9 @@ H5_DLL herr_t H5Dread_chunk(hid_t dset_id, hid_t dxpl_id, const hsize_t *offset,
* in the memory buffer \p buf, executing the callback function
* \p op once for each such data element.
*
- * The prototype of the callback function \p op is as follows
- * (as defined in the source code file H5Lpublic.h):
- * \snippet this H5D_operator_t_snip
- * The parameters of this callback function are:
- *
- * <table>
- * <tr><td>\c elem</td>
- * <td><tt>[in,out]</tt></td>
- * <td>Pointer to the memory buffer containing the current
- * data element</td></tr>
- * <tr><td>\c type_id</td>
- * <td><tt>[in]</tt></td>
- * <td>Datatype identifier of the elements stored in elem</td></tr>
- * <tr><td>\c ndim</td>
- * <td><tt>[in]</tt></td>
- * <td>Number of dimensions for the point array</td></tr>
- * <tr><td>\c point</td>
- * <td><tt>[in]</tt></td>
- * <td>Array containing the location of the element within
- * the original dataspace</td></tr>
- * <tr><td>\c operator_data</td>
- * <td><tt>[in,out]</tt></td>
- * <td>Pointer to any user-defined data associated with the
- * operation</td></tr>
- * </table>
- *
- * The possible return values from the callback function, and
- * the effect ofeach,are as follows:
- *
- * \li Zero causes the iterator to continue, returning zero
- * when all data elements have been processed.
- * \li A positive value causes the iterator to immediately
- * return that positive value, indicating short-circuit success.
- * \li A negative value causes the iterator to immediately return
- * that value, indicating failure.
- *
- * The \p operator_data parameter is a user-defined pointer to
- * the data required to process dataset elements in the course
- * of the iteration. If operator needs to pass data back to the
- * application, such data can be returned in this same buffer. This
- * pointer is passed back to each step of the iteration in the
- * operator callback function’s operator_data parameter.
- *
- * Unlike other HDF5 iterators, this iteration operation cannot
- * be restarted at the point of exit; a second H5Diterate()
- * call will always restart at the beginning.
+ * \attention Unlike other HDF5 iterators, this iteration operation cannot
+ * be restarted at the point of exit; a second H5Diterate()
+ * call will always restart at the beginning.
*
*
* \since 1.10.2
@@ -1216,30 +1178,25 @@ H5_DLL herr_t H5Dvlen_get_buf_size(hid_t dset_id, hid_t type_id, hid_t space_id,
*
* \return \herr_t
*
- * \details H5Dfill() fills the dataspace selection in memory, \p space_id,
+ * \details H5Dfill() fills the dataspace selection, \p space_id, in memory
* with the fill value specified in \p fill. If \p fill is NULL,
* a fill value of 0 (zero) is used.
*
* \p fill_type_id specifies the datatype of the fill value.
- * \p buf specifies the buffer in which the dataspace elements
- * will be written.
- * \p buf_type_id specifies the datatype of those data elements.
+ * \p buf specifies the buffer in which the fill elements
+ * will be written. \p buf_type_id specifies the datatype of
+ * those data elements.
*
* \note Note that if the fill value datatype differs from the memory
- * buffer datatype, the fill value will be converted to the memory
- * buffer datatype before filling the selection.
+ * buffer datatype, the fill value will be converted to the memory
+ * buffer datatype before filling the selection.
*
* \note Applications sometimes write data only to portions of an
- * allocated dataset. It is often useful in such cases to fill
- * the unused space with a known fill value. See the following
- * function for more information:
- * - H5Pset_fill_value()
- * - H5Pget_fill_value()
- * - H5Pfill_value_defined()
- * - H5Pset_fill_time()
- * - H5Pget_fill_time()
- * - H5Pcreate()
- * - H5Pcreate_anon()
+ * allocated dataset. It is often useful in such cases to fill
+ * the unused space with a known fill value.
+ *
+ * \see H5Pset_fill_value(), H5Pget_fill_value(), H5Pfill_value_defined(),
+ * H5Pset_fill_time(), H5Pget_fill_time(), H5Pcreate(), H5Dcreate_anon()
*
*/
H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf_type_id, hid_t space_id);
@@ -1286,22 +1243,21 @@ H5_DLL herr_t H5Dfill(const void *fill, hid_t fill_type_id, void *buf, hid_t buf
* - If the dataset’s fill time is set to #H5D_FILL_TIME_ALLOC
* (see H5Pset_alloc_time())
*
- * \note
- * \li If the sizes specified in \p size array are smaller than
- * the dataset’s current dimension sizes, H5Dset_extent() will reduce
- * the dataset’s dimension sizes to the specified values. It is the
- * user application’s responsibility to ensure that valuable data is
- * not lost as H5Dset_extent() does not check.
+ * \note If the sizes specified in \p size array are smaller than the dataset’s
+ * current dimension sizes, H5Dset_extent() will reduce the dataset’s
+ * dimension sizes to the specified values. It is the user application’s
+ * responsibility to ensure that valuable data is not lost as
+ * H5Dset_extent() does not check.
*
- * \li Except for external datasets, H5Dset_extent() is for use with
- * chunked datasets only, not contiguous datasets.
+ * \note Except for external datasets, H5Dset_extent() is for use with
+ * chunked datasets only, not contiguous datasets.
*
- * \li A call to H5Dset_extent() affects the dataspace of a dataset.
- * If a dataspace handle was opened for a dataset prior to a call to
- * H5Dset_extent() then that dataspace handle will no longer reflect
- * the correct dataspace extent of the dataset. H5Dget_space() must
- * be called (after closing the previous handle) to obtain the current
- * dataspace extent.
+ * \note A call to H5Dset_extent() affects the dataspace of a dataset. If a
+ * dataspace handle was opened for a dataset prior to a call to
+ * H5Dset_extent() then that dataspace handle will no longer reflect the
+ * correct dataspace extent of the dataset. H5Dget_space() must be called
+ * (after closing the previous handle) to obtain the current dataspace
+ * extent.
*
* \since 1.8.0
*
@@ -1336,11 +1292,11 @@ H5_DLL herr_t H5Dset_extent_async(const char *app_file, const char *app_func, un
* open files. After that, the OS is responsible for ensuring
* that the data is actually flushed to disk.
*
+ * \since 1.10.0
+ *
*/
H5_DLL herr_t H5Dflush(hid_t dset_id);
-H5_DLL herr_t H5Dwait(hid_t dset_id);
-
/**
* --------------------------------------------------------------------------
* \ingroup H5D
@@ -1396,40 +1352,7 @@ H5_DLL herr_t H5Drefresh(hid_t dset_id);
*
* To retrieve the data to be scattered, H5Dscatter() repeatedly
* calls \p op, which should return a valid source buffer, until
- * enough data to fill the selection has been retrieved. The
- * prototype of the callback function \p op is as follows (as
- * defined in the source code file H5Dpublic.h):
- * \snippet this H5D_scatter_func_t_snip
- * The parameters of this callback function are described below:
- *
- * <table>
- * <tr><td>\c src_buf</td>
- * <td><tt>[out]</tt></td>
- * <td>Pointer to the buffer holding the next set of elements to
- * scatter. On entry, the value of where \c src_buf points to
- * is undefined. The callback function should set \c src_buf
- * to point to the next set of elements.</td></tr>
- * <tr><td>\c src_buf_bytes_used</td>
- * <td><tt>[out]</tt></td>
- * <td>Pointer to the number of valid bytes in \c src_buf. On
- * entry, the value where \c src_buf_bytes_used points to is
- * undefined. The callback function should set
- * \c src_buf_bytes_used to the of valid bytes in \c src_buf.
- * This number must be a multiple of the datatype size.
- * </td></tr>
- * <tr><td>\c op_data</td>
- * <td><tt>[in,out]</tt></td>
- * <td>User-defined pointer to data required by the callback
- * function. A pass-through of the \c op_data pointer provided
- * with the H5Dscatter() function call.</td></tr>
- * </table>
- *
- * The callback function should always return at least one
- * element in \p src_buf, and must not return more elements
- * than are remaining to be scattered. This function will be
- * repeatedly called until all elements to be scattered have
- * been returned. The callback function should return zero (0)
- * to indicate success, and a negative value to indicate failure.
+ * enough data to fill the selection has been retrieved.
*
* \since 1.10.2
*
@@ -1481,27 +1404,9 @@ H5_DLL herr_t H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hi
* If no callback function is provided, H5Dgather() simply gathers
* the data into \p dst_buf and returns. If a callback function is
* provided, H5Dgather() repeatedly gathers up to \p dst_buf_size
- * bytes to process the serialized data. The prototype of the
- * callback function \p op is as follows (as defined in the source
- * code file H5Dpublic.h):
- * \snippet this H5D_gather_func_t_snip
- * The parameters of this callback function are described in the
- * table below.
- * <table>
- * <tr><td>\c dst_buf</td>
- * <td>Pointer to the destination buffer which has been filled
- * with the next set of elements gathered. This will always be
- * identical to the \p dst_buf passed to H5Dgather().</td></tr>
- * <tr><td>\c dst_buf_bytes_used</td>
- * <td>Pointer to the number of valid bytes in \p dst_buf.
- * This number must be a multiple of the datatype
- * size.</td></tr>
- * <tr><td>\c op_data</td>
- * <td>User-defined pointer to data required by the callback
- * function; a pass-through of the \p op_data pointer
- * provided with the H5Dgather() function call.</td></tr>
- * </table>
- * The callback function should process, store, or otherwise,
+ * bytes to process the serialized data.
+ *
+ * The callback function \p op should process, store, or otherwise,
* make use of the data returned in \p dst_buf before it returns,
* because the buffer will be overwritten unless it is the last
* call to the callback. This function will be repeatedly called
@@ -1525,11 +1430,11 @@ H5_DLL herr_t H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id,
*
* \return \herr_t
*
- * \details H5Dclose() ends access to a dataset specified by \p dset_id
- * and releases resources used by it.
+ * \details H5Dclose() terminates access to a dataset via the identifier
+ * \p dset_id and releases the underlying resources.
*
- * \attention Further use of a released dataset identifier is illegal; a
- * function using such an identifier will generate an error.
+ * \par Example
+ * \snippet H5D_examples.c read
*
* \since 1.8.0
*
@@ -1545,12 +1450,14 @@ H5_DLL herr_t H5Dclose(hid_t dset_id);
*/
H5_DLL herr_t H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
hid_t es_id);
-
+/// \cond DEV
/* Internal API routines */
H5_DLL herr_t H5Ddebug(hid_t dset_id);
H5_DLL herr_t H5Dformat_convert(hid_t dset_id);
H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
+/// \endcond
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1574,6 +1481,7 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
#define H5Dset_extent_async_wrap H5_NO_EXPAND(H5Dset_extent_async)
#define H5Dclose_async_wrap H5_NO_EXPAND(H5Dclose_async)
#endif /* H5D_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
@@ -1614,8 +1522,7 @@ H5_DLL herr_t H5Dget_chunk_index_type(hid_t did, H5D_chunk_index_t *idx_type);
*
* \return \hid_t{dataset}
*
- * \deprecated This function is deprecated in favor of the function H5Dcreate2()
- * or the macro H5Dcreate().
+ * \deprecation_note{H5Dcreate2() or the macro H5Dcreate()}
*
* \details H5Dcreate1() creates a data set with a name, \p name, in the
* location specified by the identifier \p loc_id. \p loc_id may be a
@@ -1681,8 +1588,7 @@ H5_DLL hid_t H5Dcreate1(hid_t loc_id, const char *name, hid_t type_id, hid_t spa
*
* \return \hid_t{dataset}
*
- * \deprecated This function is deprecated in favor of the function H5Dopen2()
- * or the macro H5Dopen().
+ * \deprecation_note{H5Dopen2() or the macro H5Dopen()}
*
* \details H5Dopen1() opens an existing dataset for access at the location
* specified by \p loc_id. \p loc_id may be a file, group, dataset,
@@ -1712,10 +1618,10 @@ H5_DLL hid_t H5Dopen1(hid_t loc_id, const char *name);
*
* \return \herr_t
*
- * \deprecated This function is deprecated in favor of the function H5Dset_extent().
+ * \deprecation_note{H5Dset_extent()}
*
* \details H5Dextend() verifies that the dataset is at least of size \p size,
- * extending it if necessary. The dimensionality of size is the same as
+ * extending it if necessary. The length of \p size is the same as
* that of the dataspace of the dataset being changed.
*
* This function can be applied to the following datasets:
@@ -1735,7 +1641,7 @@ H5_DLL hid_t H5Dopen1(hid_t loc_id, const char *name);
* the sizes specified in size. The function H5Dset_extent() must be
* used if the dataset dimension sizes are are to be reduced.
*
- * \version 1.8.0 Function Function deprecated in this release. Parameter size
+ * \version 1.8.0 Function deprecated in this release. Parameter size
* syntax changed to \Code{const hsize_t size[]} in this release.
*
*/
@@ -1753,8 +1659,7 @@ H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]);
*
* \return \herr_t
*
- * \deprecated This function has been deprecated in HDF5-1.12 in favor of the
- * function H5Treclaim().
+ * \deprecation_note{H5Treclaim()}
*
* \details H5Dvlen_reclaim() reclaims memory buffers created to store VL
* datatypes.
@@ -1772,7 +1677,7 @@ H5_DLL herr_t H5Dextend(hid_t dset_id, const hsize_t size[]);
* frees them from the bottom up, releasing all the memory without
* creating memory leaks.
*
- * \version 1.12.0 Routine was deprecated
+ * \version 1.12.0 Function was deprecated
*
*/
H5_DLL herr_t H5Dvlen_reclaim(hid_t type_id, hid_t space_id, hid_t dxpl_id, void *buf);
diff --git a/src/H5Dvirtual.c b/src/H5Dvirtual.c
index d1c0266..d5375c1 100644
--- a/src/H5Dvirtual.c
+++ b/src/H5Dvirtual.c
@@ -3129,7 +3129,7 @@ H5D__virtual_refresh_source_dset(H5D_t **dset)
HGOTO_ERROR(H5E_DATASET, H5E_CANTREGISTER, FAIL, "can't register (temporary) source dataset ID")
/* Refresh source dataset */
- if (H5D__refresh(temp_id, *dset) < 0)
+ if (H5D__refresh(*dset, temp_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to refresh source dataset")
/* Discard the identifier & replace the dataset */
diff --git a/src/H5E.c b/src/H5E.c
index b8e17a4..a5a9a2e 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -639,7 +639,7 @@ H5E__get_class_name(const H5E_cls_t *cls, char *name, size_t size)
/* Set the user's buffer, if provided */
if (name) {
- HDstrncpy(name, cls->cls_name, MIN((size_t)(len + 1), size));
+ HDstrncpy(name, cls->cls_name, size);
if ((size_t)len >= size)
name[size - 1] = '\0';
} /* end if */
@@ -996,11 +996,12 @@ H5E__get_current_stack(void)
if (H5I_inc_ref(current_error->min_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, NULL, "unable to increment ref count on error message")
new_error->min_num = current_error->min_num;
- if (NULL == (new_error->func_name = H5MM_xstrdup(current_error->func_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- if (NULL == (new_error->file_name = H5MM_xstrdup(current_error->file_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
- new_error->line = current_error->line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ new_error->func_name = current_error->func_name;
+ new_error->file_name = current_error->file_name;
+ new_error->line = current_error->line;
if (NULL == (new_error->desc = H5MM_xstrdup(current_error->desc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed")
} /* end for */
@@ -1116,11 +1117,12 @@ H5E__set_current_stack(H5E_t *estack)
if (H5I_inc_ref(new_error->min_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error class")
current_error->min_num = new_error->min_num;
- if (NULL == (current_error->func_name = H5MM_xstrdup(new_error->func_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- if (NULL == (current_error->file_name = H5MM_xstrdup(new_error->file_name)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
- current_error->line = new_error->line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ current_error->func_name = new_error->func_name;
+ current_error->file_name = new_error->file_name;
+ current_error->line = new_error->line;
if (NULL == (current_error->desc = H5MM_xstrdup(new_error->desc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed")
} /* end for */
@@ -1813,11 +1815,12 @@ H5E__append_stack(H5E_t *dst_stack, const H5E_t *src_stack)
if (H5I_inc_ref(src_error->min_num, FALSE) < 0)
HGOTO_ERROR(H5E_ERROR, H5E_CANTINC, FAIL, "unable to increment ref count on error message")
dst_error->min_num = src_error->min_num;
- if (NULL == (dst_error->func_name = H5MM_xstrdup(src_error->func_name)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed")
- if (NULL == (dst_error->file_name = H5MM_xstrdup(src_error->file_name)))
- HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed")
- dst_error->line = src_error->line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ dst_error->func_name = src_error->func_name;
+ dst_error->file_name = src_error->file_name;
+ dst_error->line = src_error->line;
if (NULL == (dst_error->desc = H5MM_xstrdup(src_error->desc)))
HGOTO_ERROR(H5E_ERROR, H5E_CANTALLOC, FAIL, "memory allocation failed")
diff --git a/src/H5ES.c b/src/H5ES.c
index 2ba8a72..ccc0dd8 100644
--- a/src/H5ES.c
+++ b/src/H5ES.c
@@ -34,11 +34,12 @@
/***********/
/* Headers */
/***********/
-#include "H5private.h" /* Generic Functions */
-#include "H5Eprivate.h" /* Error handling */
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
#include "H5ESpkg.h" /* Event Sets */
#include "H5FLprivate.h" /* Free Lists */
#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
/****************/
/* Local Macros */
@@ -103,10 +104,61 @@ done:
} /* end H5EScreate() */
/*-------------------------------------------------------------------------
+ * Function: H5ESinsert_request
+ *
+ * Purpose: Insert a request from a VOL connector into an event set.
+ *
+ * Note: This function is primarily targeted at VOL connector
+ * authors and is _not_ designed for general-purpose application use.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESinsert_request(hid_t es_id, hid_t connector_id, void *request)
+{
+ H5ES_t *es; /* Event set */
+ H5VL_t *connector = NULL; /* VOL connector */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ii*x", es_id, connector_id, request);
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == request)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL request pointer")
+
+ /* Create new VOL connector object, using the connector ID */
+ if (NULL == (connector = H5VL_new_connector(connector_id)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create VOL connector object")
+
+ /* Insert request into event set */
+ if (H5ES__insert_request(es, connector, request) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "can't insert request into event set")
+
+done:
+ /* Clean up on error */
+ if (ret_value < 0)
+ /* Release newly created connector */
+ if (connector && H5VL_conn_dec_rc(connector) < 0)
+ HDONE_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on VOL connector")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESinsert_request() */
+
+/*-------------------------------------------------------------------------
* Function: H5ESget_count
*
* Purpose: Retrieve the # of events in an event set
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -117,19 +169,23 @@ done:
herr_t
H5ESget_count(hid_t es_id, size_t *count /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, count);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
- /* Retrieve the count, if non-NULL */
- if (count)
- *count = H5ES__list_count(&es->active);
+ /* Retrieve the count, if non-NULL */
+ if (count)
+ *count = H5ES__list_count(&es->active);
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -145,6 +201,8 @@ done:
* mechanism for matching operations inserted into the event
* set with [possible] errors that occur.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -155,19 +213,23 @@ done:
herr_t
H5ESget_op_counter(hid_t es_id, uint64_t *op_counter /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, op_counter);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
- /* Retrieve the operation counter, if non-NULL */
- if (op_counter)
- *op_counter = es->op_counter;
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+
+ /* Retrieve the operation counter, if non-NULL */
+ if (op_counter)
+ *op_counter = es->op_counter;
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -192,6 +254,8 @@ done:
* value returned for the # of operations in progress may be
* inaccurate.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -202,33 +266,82 @@ done:
herr_t
H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress /*out*/, hbool_t *op_failed /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iULxx", es_id, timeout, num_in_progress, op_failed);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
- if (NULL == num_in_progress)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_in_progress pointer")
- if (NULL == op_failed)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer")
-
- /* Wait for operations */
- if (H5ES__wait(es, timeout, num_in_progress, op_failed) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, FAIL, "can't wait on operations")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == num_in_progress)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_in_progress pointer")
+ if (NULL == op_failed)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer")
+
+ /* Wait for operations */
+ if (H5ES__wait(es, timeout, num_in_progress, op_failed) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTWAIT, FAIL, "can't wait on operations")
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
} /* end H5ESwait() */
/*-------------------------------------------------------------------------
+ * Function: H5EScancel
+ *
+ * Purpose: Attempt to cancel operations in an event set
+ *
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 10, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5EScancel(hid_t es_id, size_t *num_not_canceled /*out*/, hbool_t *op_failed /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "ixx", es_id, num_not_canceled, op_failed);
+
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == num_not_canceled)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL num_not_canceled pointer")
+ if (NULL == op_failed)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL op_failed pointer")
+
+ /* Cancel operations */
+ if (H5ES__cancel(es, num_not_canceled, op_failed) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, FAIL, "can't cancel operations")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5EScancel() */
+
+/*-------------------------------------------------------------------------
* Function: H5ESget_err_status
*
* Purpose: Check if event set has failed operations
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -239,19 +352,23 @@ done:
herr_t
H5ESget_err_status(hid_t es_id, hbool_t *err_status /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, err_status);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
- /* Retrieve the error flag, if non-NULL */
- if (err_status)
- *err_status = es->err_occurred;
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+
+ /* Retrieve the error flag, if non-NULL */
+ if (err_status)
+ *err_status = es->err_occurred;
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -265,6 +382,8 @@ done:
* Note: Does not wait for active operations to complete, so count may
* not include all failures.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -275,23 +394,27 @@ done:
herr_t
H5ESget_err_count(hid_t es_id, size_t *num_errs /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", es_id, num_errs);
- /* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
- /* Retrieve the error flag, if non-NULL */
- if (num_errs) {
- if (es->err_occurred)
- *num_errs = H5ES__list_count(&es->failed);
- else
- *num_errs = 0;
- } /* end if */
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+
+ /* Retrieve the error flag, if non-NULL */
+ if (num_errs) {
+ if (es->err_occurred)
+ *num_errs = H5ES__list_count(&es->failed);
+ else
+ *num_errs = 0;
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
@@ -305,6 +428,8 @@ done:
* Note: The strings retrieved for each error info must be released
* by calling H5free_memory().
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -316,29 +441,164 @@ herr_t
H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[] /*out*/,
size_t *num_cleared /*out*/)
{
- H5ES_t *es; /* Event set */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "izxx", es_id, num_err_info, err_info, num_cleared);
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (0 == num_err_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0")
+ if (NULL == err_info)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer")
+ if (NULL == num_cleared)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL errors cleared pointer")
+
+ /* Retrieve the error information */
+ if (H5ES__get_err_info(es, num_err_info, err_info, num_cleared) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't retrieve error info for failed operation(s)")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESget_err_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ESfree_err_info
+ *
+ * Purpose: Convenience routine to free 1+ H5ES_err_info_t structs.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, March 5, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[])
+{
+ size_t u; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "z*#", num_err_info, err_info);
+
/* Check arguments */
- if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
if (0 == num_err_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "err_info array size is 0")
if (NULL == err_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL err_info array pointer")
- if (NULL == num_cleared)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL errors cleared pointer")
- /* Retrieve the error information */
- if (H5ES__get_err_info(es, num_err_info, err_info, num_cleared) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't retrieve error info for failed operation(s)")
+ /* Iterate over array, releasing error information */
+ for (u = 0; u < num_err_info; u++) {
+ H5MM_xfree(err_info[u].api_name);
+ H5MM_xfree(err_info[u].api_args);
+ H5MM_xfree(err_info[u].app_file_name);
+ H5MM_xfree(err_info[u].app_func_name);
+ if (H5I_dec_app_ref(err_info[u].err_stack_id) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "can't close error stack for err_info #%zu", u)
+ } /* end for */
done:
FUNC_LEAVE_API(ret_value)
-} /* end H5ESget_err_info() */
+} /* end H5ESfree_err_info() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ESregister_insert_func
+ *
+ * Purpose: Registers a callback to invoke when a new operation is inserted
+ * into an event set.
+ *
+ * Note: Only one insert callback can be registered for each event set.
+ * Registering a new callback will replace the existing one.
+ *
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESregister_insert_func(hid_t es_id, H5ES_event_insert_func_t func, void *ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "iEI*x", es_id, func, ctx);
+
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == func)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer")
+
+ /* Set the event set's insert callback */
+ es->ins_func = func;
+ es->ins_ctx = ctx;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESregister_insert_func() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ESregister_complete_func
+ *
+ * Purpose: Registers a callback to invoke when an operation completes
+ * within an event set.
+ *
+ * Note: Only one complete callback can be registered for each event set.
+ * Registering a new callback will replace the existing one.
+ *
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t func, void *ctx)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "iEC*x", es_id, func, ctx);
+
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ H5ES_t *es; /* Event set */
+
+ /* Check arguments */
+ if (NULL == (es = H5I_object_verify(es_id, H5I_EVENTSET)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid event set identifier")
+ if (NULL == func)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL function callback pointer")
+
+ /* Set the event set's completion callback */
+ es->comp_func = func;
+ es->comp_ctx = ctx;
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5ESregister_complete_func() */
/*-------------------------------------------------------------------------
* Function: H5ESclose
@@ -347,6 +607,8 @@ done:
*
* Note: Fails if active operations are present.
*
+ * Note: H5ES_NONE is a valid value for 'es_id', but functions as a no-op
+ *
* Return: SUCCEED / FAIL
*
* Programmer: Quincey Koziol
@@ -362,16 +624,19 @@ H5ESclose(hid_t es_id)
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", es_id);
- /* Check arguments */
- if (H5I_EVENTSET != H5I_get_type(es_id))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set")
-
- /*
- * Decrement the counter on the object. It will be freed if the count
- * reaches zero.
- */
- if (H5I_dec_app_ref(es_id) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on event set")
+ /* Passing H5ES_NONE is valid, but a no-op */
+ if (H5ES_NONE != es_id) {
+ /* Check arguments */
+ if (H5I_EVENTSET != H5I_get_type(es_id))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not an event set")
+
+ /*
+ * Decrement the counter on the object. It will be freed if the count
+ * reaches zero.
+ */
+ if (H5I_dec_app_ref(es_id) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL, "unable to decrement ref count on event set")
+ } /* end if */
done:
FUNC_LEAVE_API(ret_value)
diff --git a/src/H5ESdevelop.h b/src/H5ESdevelop.h
new file mode 100644
index 0000000..5a0f2b4
--- /dev/null
+++ b/src/H5ESdevelop.h
@@ -0,0 +1,50 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * This file contains public declarations for the H5ES (event set) developer
+ * support routines.
+ */
+
+#ifndef _H5ESdevelop_H
+#define _H5ESdevelop_H
+
+/* Include package's public header */
+#include "H5ESpublic.h"
+
+/*****************/
+/* Public Macros */
+/*****************/
+
+/*******************/
+/* Public Typedefs */
+/*******************/
+
+/********************/
+/* Public Variables */
+/********************/
+
+/*********************/
+/* Public Prototypes */
+/*********************/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+H5_DLL herr_t H5ESinsert_request(hid_t es_id, hid_t connector_id, void *request);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _H5ESdevelop_H */
diff --git a/src/H5ESevent.c b/src/H5ESevent.c
index b0c3578..aafc785 100644
--- a/src/H5ESevent.c
+++ b/src/H5ESevent.c
@@ -139,14 +139,14 @@ H5ES__event_free(H5ES_event_t *ev)
/* Sanity check */
HDassert(ev);
- if (ev->api_name)
- H5MM_xfree_const(ev->api_name);
- if (ev->api_args)
- H5MM_xfree_const(ev->api_args);
- if (ev->app_file)
- H5MM_xfree_const(ev->app_file);
- if (ev->app_func)
- H5MM_xfree_const(ev->app_func);
+ /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ ev->op_info.api_name = NULL;
+ if (ev->op_info.api_args)
+ H5MM_xfree_const(ev->op_info.api_args);
+ ev->op_info.app_file_name = NULL;
+ ev->op_info.app_func_name = NULL;
if (ev->request) {
/* Free the request */
if (H5VL_request_free(ev->request) < 0)
diff --git a/src/H5ESint.c b/src/H5ESint.c
index da3f779..6f9efe9 100644
--- a/src/H5ESint.c
+++ b/src/H5ESint.c
@@ -53,11 +53,18 @@
/* Callback context for wait operations */
typedef struct H5ES_wait_ctx_t {
H5ES_t * es; /* Event set being operated on */
- uint64_t timeout; /* Timeout for wait operation */
+ uint64_t timeout; /* Timeout for wait operation (in ns) */
size_t * num_in_progress; /* Count of # of operations that have not completed */
hbool_t *op_failed; /* Flag to indicate an operation failed */
} H5ES_wait_ctx_t;
+/* Callback context for cancel operations */
+typedef struct H5ES_cancel_ctx_t {
+ H5ES_t * es; /* Event set being operated on */
+ size_t * num_not_canceled; /* Count of # of operations were not canceled */
+ hbool_t *op_failed; /* Flag to indicate an operation failed */
+} H5ES_cancel_ctx_t;
+
/* Callback context for get error info (gei) operations */
typedef struct H5ES_gei_ctx_t {
H5ES_t * es; /* Event set being operated on */
@@ -73,9 +80,14 @@ typedef struct H5ES_gei_ctx_t {
/********************/
/* Local Prototypes */
/********************/
+static herr_t H5ES__close(H5ES_t *es);
static herr_t H5ES__close_cb(void *es, void **request_token);
+static herr_t H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app_file,
+ const char *app_func, unsigned app_line, const char *caller, const char *api_args);
static herr_t H5ES__handle_fail(H5ES_t *es, H5ES_event_t *ev);
+static herr_t H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status);
static int H5ES__wait_cb(H5ES_event_t *ev, void *_ctx);
+static int H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx);
static int H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx);
static int H5ES__close_failed_cb(H5ES_event_t *ev, void *_ctx);
@@ -233,6 +245,81 @@ done:
} /* end H5ES__create() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__insert
+ *
+ * Purpose: Insert a request token into an event set
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5ES__insert(H5ES_t *es, H5VL_t *connector, void *request_token, const char *app_file, const char *app_func,
+ unsigned app_line, const char *caller, const char *api_args)
+{
+ H5ES_event_t *ev = NULL; /* Event for request */
+ hbool_t ev_inserted = FALSE; /* Flag to indicate that event is in active list */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(es);
+
+ /* Create new event */
+ if (NULL == (ev = H5ES__event_new(connector, request_token)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create event object")
+
+ /* Copy the app source information */
+ /* The 'app_func' & 'app_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ev->op_info.app_file_name = app_file;
+ ev->op_info.app_func_name = app_func;
+ ev->op_info.app_line_num = app_line;
+
+ /* Set the event's operation counter */
+ ev->op_info.op_ins_count = es->op_counter++;
+
+ /* Set the event's timestamp & execution time */
+ ev->op_info.op_ins_ts = H5_now_usec();
+ ev->op_info.op_exec_ts = UINT64_MAX;
+ ev->op_info.op_exec_time = UINT64_MAX;
+
+ /* Copy the API routine's name & arguments */
+ /* The 'caller' string is also statically allocated (by the compiler)
+ * there's no need to duplicate it.
+ */
+ ev->op_info.api_name = caller;
+ if (NULL == (ev->op_info.api_args = H5MM_xstrdup(api_args)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments")
+
+ /* Append fully initialized event onto the event set's 'active' list */
+ H5ES__list_append(&es->active, ev);
+ ev_inserted = TRUE;
+
+ /* Invoke the event set's 'insert' callback, if present */
+ if (es->ins_func)
+ if ((es->ins_func)(&ev->op_info, es->ins_ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'insert' callback for event set failed")
+
+done:
+ /* Release resources on error */
+ if (ret_value < 0)
+ if (ev) {
+ if (ev_inserted)
+ H5ES__list_remove(&es->active, ev);
+ if (H5ES__event_free(ev) < 0)
+ HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release event")
+ }
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__insert() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES_insert
*
* Purpose: Insert a request token into an event set
@@ -247,15 +334,15 @@ done:
herr_t
H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, const char *caller_args, ...)
{
- H5ES_t * es = NULL; /* Event set for the operation */
- H5ES_event_t *ev = NULL; /* Event for request */
- H5RS_str_t * rs = NULL; /* Ref-counted string to compose formatted argument string in */
- const char * app_file; /* Application source file name */
- const char * app_func; /* Application source function name */
- const char * s; /* Pointer to internal string from ref-counted string */
- va_list ap; /* Varargs for caller */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5ES_t * es = NULL; /* Event set for the operation */
+ const char *app_file; /* Application source file name */
+ const char *app_func; /* Application source function name */
+ unsigned app_line; /* Application source line number */
+ H5RS_str_t *rs = NULL; /* Ref-counted string to compose formatted argument string in */
+ const char *api_args; /* Pointer to api_args string from ref-counted string */
+ va_list ap; /* Varargs for caller */
+ hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -273,10 +360,6 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con
if (es->err_occurred)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations")
- /* Create new event */
- if (NULL == (ev = H5ES__event_new(connector, token)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCREATE, FAIL, "can't create event object")
-
/* Start working on the API routines arguments */
HDva_start(ap, caller_args);
arg_started = TRUE;
@@ -284,24 +367,10 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con
/* Copy the app source information */
(void)HDva_arg(ap, char *); /* Toss the 'app_file' parameter name */
app_file = HDva_arg(ap, char *);
- if (NULL == (ev->app_file = H5MM_strdup(app_file)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy app source file name")
(void)HDva_arg(ap, char *); /* Toss the 'app_func' parameter name */
app_func = HDva_arg(ap, char *);
- if (NULL == (ev->app_func = H5MM_strdup(app_func)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy app source function name")
(void)HDva_arg(ap, char *); /* Toss the 'app_line' parameter name */
- ev->app_line = HDva_arg(ap, unsigned);
-
- /* Set the event's operation counter */
- ev->ev_count = es->op_counter++;
-
- /* Set the event's timestamp */
- ev->ev_time = H5_now_usec();
-
- /* Copy the API routine's name */
- if (NULL == (ev->api_name = H5MM_strdup(caller)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine name")
+ app_line = HDva_arg(ap, unsigned);
/* Create the string for the API routine's arguments */
if (NULL == (rs = H5RS_create(NULL)))
@@ -312,13 +381,12 @@ H5ES_insert(hid_t es_id, H5VL_t *connector, void *token, const char *caller, con
HDassert(0 == HDstrncmp(caller_args, "*s*sIu", 6));
if (H5_trace_args(rs, caller_args + 6, ap) < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "can't create formatted API arguments")
- if (NULL == (s = H5RS_get_str(rs)))
+ if (NULL == (api_args = H5RS_get_str(rs)))
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "can't get pointer to formatted API arguments")
- if (NULL == (ev->api_args = H5MM_strdup(s)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, FAIL, "can't copy API routine arguments")
- /* Append fully initialized event onto the event set's 'active' list */
- H5ES__list_append(&es->active, ev);
+ /* Insert the operation into the event set */
+ if (H5ES__insert(es, connector, token, app_file, app_func, app_line, caller, api_args) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations")
done:
/* Clean up */
@@ -327,15 +395,42 @@ done:
if (rs)
H5RS_decr(rs);
- /* Release resources on error */
- if (ret_value < 0)
- if (ev && H5ES__event_free(ev) < 0)
- HDONE_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release event")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5ES_insert() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__insert_request
+ *
+ * Purpose: Directly insert a request token into an event set
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ES__insert_request(H5ES_t *es, H5VL_t *connector, void *token)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(es);
+ HDassert(connector);
+ HDassert(token);
+
+ /* Insert an 'anonymous' operation into the event set */
+ if (H5ES__insert(es, connector, token, NULL, NULL, 0, NULL, NULL) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTINSERT, FAIL, "event set has failed operations")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__insert_request() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES__handle_fail
*
* Purpose: Handle a failed event
@@ -370,6 +465,101 @@ H5ES__handle_fail(H5ES_t *es, H5ES_event_t *ev)
} /* end H5ES__handle_fail() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__op_complete
+ *
+ * Purpose: Handle an operation completing
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, December 11, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status)
+{
+ H5VL_request_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t err_stack_id = H5I_INVALID_HID; /* Error stack for failed operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(es);
+ HDassert(ev);
+ HDassert(H5VL_REQUEST_STATUS_SUCCEED == ev_status || H5VL_REQUEST_STATUS_FAIL == ev_status ||
+ H5VL_REQUEST_STATUS_CANCELED == ev_status);
+
+ /* Handle each form of event completion */
+ if (H5VL_REQUEST_STATUS_SUCCEED == ev_status || H5VL_REQUEST_STATUS_CANCELED == ev_status) {
+ /* Invoke the event set's 'complete' callback, if present */
+ if (es->comp_func) {
+ H5ES_status_t op_status; /* Status for complete callback */
+
+ /* Set appropriate info for callback */
+ if (H5VL_REQUEST_STATUS_SUCCEED == ev_status) {
+ /* Translate status */
+ op_status = H5ES_STATUS_SUCCEED;
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_REQUEST_GET_EXEC_TIME;
+ vol_cb_args.args.get_exec_time.exec_ts = &ev->op_info.op_exec_ts;
+ vol_cb_args.args.get_exec_time.exec_time = &ev->op_info.op_exec_time;
+
+ /* Retrieve the execution time info */
+ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL,
+ "unable to retrieve execution time info for operation")
+ }
+ else
+ /* Translate status */
+ op_status = H5ES_STATUS_CANCELED;
+
+ if ((es->comp_func)(&ev->op_info, op_status, H5I_INVALID_HID, es->comp_ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed")
+ } /* end if */
+
+ /* Event success or cancellation */
+ if (H5ES__event_completed(ev, &es->active) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, FAIL, "unable to release completed event")
+ } /* end if */
+ else if (H5VL_REQUEST_STATUS_FAIL == ev_status) {
+ /* Invoke the event set's 'complete' callback, if present */
+ if (es->comp_func) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_REQUEST_GET_ERR_STACK;
+ vol_cb_args.args.get_err_stack.err_stack_id = H5I_INVALID_HID;
+
+ /* Retrieve the error stack for the operation */
+ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, FAIL, "unable to retrieve error stack for operation")
+
+ /* Set values */
+ err_stack_id = vol_cb_args.args.get_err_stack.err_stack_id;
+
+ if ((es->comp_func)(&ev->op_info, H5ES_STATUS_FAIL, err_stack_id, es->comp_ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed")
+ } /* end if */
+
+ /* Handle failure */
+ if (H5ES__handle_fail(es, ev) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, FAIL, "unable to handle failed event")
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, FAIL, "unknown event status?!?")
+
+done:
+ /* Clean up */
+ if (H5I_INVALID_HID != err_stack_id)
+ if (H5I_dec_ref(err_stack_id) < 0)
+ HDONE_ERROR(H5E_EVENTSET, H5E_CANTDEC, FAIL,
+ "unable to decrement ref count on error stack for failed operation")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__op_complete() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES__wait_cb
*
* Purpose: Common routine for testing / waiting on an operation
@@ -405,9 +595,9 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx)
/* Check for status values that indicate we should break out of the loop */
if (ev_status == H5VL_REQUEST_STATUS_FAIL) {
- /* Handle failure */
- if (H5ES__handle_fail(ctx->es, ev) < 0)
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, H5_ITER_ERROR, "unable to handle failed event")
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
/* Record the error */
*ctx->op_failed = TRUE;
@@ -415,13 +605,15 @@ H5ES__wait_cb(H5ES_event_t *ev, void *_ctx)
/* Exit from the iteration */
ret_value = H5_ITER_STOP;
} /* end if */
- else if (ev_status == H5VL_REQUEST_STATUS_SUCCEED) {
- if (H5ES__event_completed(ev, &ctx->es->active) < 0)
+ else if (ev_status == H5VL_REQUEST_STATUS_SUCCEED || ev_status == H5VL_REQUEST_STATUS_CANCELED) {
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
} /* end else-if */
- else if (ev_status == H5VL_REQUEST_STATUS_CANCELED)
- /* Should never get a status of 'cancel' back from test / wait operation */
- HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, H5_ITER_ERROR, "received 'cancel' status for operation")
+ else if (ev_status == H5VL_REQUEST_STATUS_CANT_CANCEL)
+ /* Should never get a status of 'can't cancel' back from test / wait operation */
+ HGOTO_ERROR(H5E_EVENTSET, H5E_BADVALUE, H5_ITER_ERROR,
+ "received \"can't cancel\" status for operation")
else {
/* Sanity check */
HDassert(ev_status == H5VL_REQUEST_STATUS_IN_PROGRESS);
@@ -489,6 +681,114 @@ done:
} /* end H5ES__wait() */
/*-------------------------------------------------------------------------
+ * Function: H5ES__cancel_cb
+ *
+ * Purpose: Callback for canceling operations
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 10, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+static int
+H5ES__cancel_cb(H5ES_event_t *ev, void *_ctx)
+{
+ H5ES_cancel_ctx_t * ctx = (H5ES_cancel_ctx_t *)_ctx; /* Callback context */
+ H5VL_request_status_t ev_status = H5VL_REQUEST_STATUS_SUCCEED; /* Status from event's operation */
+ int ret_value = H5_ITER_CONT; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Sanity check */
+ HDassert(ev);
+ HDassert(ctx);
+
+ /* Attempt to cancel the request */
+ if (H5VL_request_cancel(ev->request, &ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTCANCEL, H5_ITER_ERROR, "unable to cancel operation")
+
+ /* Check for status values that indicate we should break out of the loop */
+ if (ev_status == H5VL_REQUEST_STATUS_FAIL) {
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTSET, H5_ITER_ERROR, "unable to handle failed event")
+
+ /* Record the error */
+ *ctx->op_failed = TRUE;
+
+ /* Exit from the iteration */
+ ret_value = H5_ITER_STOP;
+ } /* end if */
+ else if (ev_status == H5VL_REQUEST_STATUS_SUCCEED) {
+ /* Increment "not canceled" counter */
+ (*ctx->num_not_canceled)++;
+
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
+ } /* end else-if */
+ else if (ev_status == H5VL_REQUEST_STATUS_CANT_CANCEL || ev_status == H5VL_REQUEST_STATUS_IN_PROGRESS) {
+ /* Increment "not canceled" counter */
+ (*ctx->num_not_canceled)++;
+ } /* end else-if */
+ else {
+ /* Sanity check */
+ HDassert(ev_status == H5VL_REQUEST_STATUS_CANCELED);
+
+ /* Handle event completion */
+ if (H5ES__op_complete(ctx->es, ev, ev_status) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTRELEASE, H5_ITER_ERROR, "unable to release completed event")
+ } /* end else */
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__cancel_cb() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5ES__cancel
+ *
+ * Purpose: Cancel operations in event set
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Thursday, December 10, 2020
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5ES__cancel(H5ES_t *es, size_t *num_not_canceled, hbool_t *op_failed)
+{
+ H5ES_cancel_ctx_t ctx; /* Iterator callback context info */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity check */
+ HDassert(es);
+ HDassert(num_not_canceled);
+ HDassert(op_failed);
+
+ /* Set user's parameters to known values */
+ *num_not_canceled = 0;
+ *op_failed = FALSE;
+
+ /* Set up context for iterator callbacks */
+ ctx.es = es;
+ ctx.num_not_canceled = num_not_canceled;
+ ctx.op_failed = op_failed;
+
+ /* Iterate over the events in the set, attempting to cancel them */
+ if (H5ES__list_iterate(&es->active, H5ES__cancel_cb, &ctx) < 0)
+ HGOTO_ERROR(H5E_EVENTSET, H5E_BADITER, FAIL, "iteration failed")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5ES__cancel() */
+
+/*-------------------------------------------------------------------------
* Function: H5ES__get_err_info_cb
*
* Purpose: Retrieve information about a failed operation
@@ -503,8 +803,9 @@ done:
static int
H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx)
{
- H5ES_gei_ctx_t *ctx = (H5ES_gei_ctx_t *)_ctx; /* Callback context */
- int ret_value = H5_ITER_CONT; /* Return value */
+ H5VL_request_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5ES_gei_ctx_t * ctx = (H5ES_gei_ctx_t *)_ctx; /* Callback context */
+ int ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -513,22 +814,35 @@ H5ES__get_err_info_cb(H5ES_event_t *ev, void *_ctx)
HDassert(ctx);
/* Copy operation info for event */
- if (NULL == (ctx->curr_err_info->api_name = H5MM_strdup(ev->api_name)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API name")
- if (NULL == (ctx->curr_err_info->api_args = H5MM_strdup(ev->api_args)))
+ /* The 'app_func_name', 'app_file_name', and 'api_name' strings are statically allocated (by the compiler)
+ * so there's no need to duplicate them internally, but they are duplicated
+ * here, when they are given back to the user.
+ */
+ if (NULL == (ctx->curr_err_info->api_name = H5MM_strdup(ev->op_info.api_name)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine name")
+ if (NULL == (ctx->curr_err_info->api_args = H5MM_strdup(ev->op_info.api_args)))
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 API routine arguments")
- if (NULL == (ctx->curr_err_info->app_file_name = H5MM_strdup(ev->app_file)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy app source file name")
- if (NULL == (ctx->curr_err_info->app_func_name = H5MM_strdup(ev->app_func)))
- HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy app function name")
- ctx->curr_err_info->app_line_num = ev->app_line;
- ctx->curr_err_info->op_ins_count = ev->ev_count;
- ctx->curr_err_info->op_ins_ts = ev->ev_time;
+ if (NULL == (ctx->curr_err_info->app_file_name = H5MM_strdup(ev->op_info.app_file_name)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application file name")
+ if (NULL == (ctx->curr_err_info->app_func_name = H5MM_strdup(ev->op_info.app_func_name)))
+ HGOTO_ERROR(H5E_EVENTSET, H5E_CANTALLOC, H5_ITER_ERROR, "can't copy HDF5 application function name")
+ ctx->curr_err_info->app_line_num = ev->op_info.app_line_num;
+ ctx->curr_err_info->op_ins_count = ev->op_info.op_ins_count;
+ ctx->curr_err_info->op_ins_ts = ev->op_info.op_ins_ts;
+ ctx->curr_err_info->op_exec_ts = ev->op_info.op_exec_ts;
+ ctx->curr_err_info->op_exec_time = ev->op_info.op_exec_time;
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_REQUEST_GET_ERR_STACK;
+ vol_cb_args.args.get_err_stack.err_stack_id = H5I_INVALID_HID;
/* Get error stack for event */
- if (H5VL_request_specific(ev->request, H5VL_REQUEST_GET_ERR_STACK, &ctx->curr_err_info->err_stack_id) < 0)
+ if (H5VL_request_specific(ev->request, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CANTGET, H5_ITER_ERROR, "unable to retrieve error stack for operation")
+ /* Set value */
+ ctx->curr_err_info->err_stack_id = vol_cb_args.args.get_err_stack.err_stack_id;
+
/* Remove event from event set's failed list */
H5ES__list_remove(&ctx->es->failed, ev);
diff --git a/src/H5ESmodule.h b/src/H5ESmodule.h
index cbc812e..5169b52 100644
--- a/src/H5ESmodule.h
+++ b/src/H5ESmodule.h
@@ -29,8 +29,10 @@
#define H5_MY_PKG_ERR H5E_EVENTSET
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5ES H5ES
+/**\defgroup H5ES H5ES
+ *
+ * \todo Add the event set life cycle.
+ *
* \brief Event Set Interface
*
* \details \Bold{This interface can be only used with the HDF5 VOL connectors that
diff --git a/src/H5ESpkg.h b/src/H5ESpkg.h
index 339ce1d..a7a8e20 100644
--- a/src/H5ESpkg.h
+++ b/src/H5ESpkg.h
@@ -43,14 +43,7 @@ typedef struct H5ES_event_t {
H5VL_object_t * request; /* Request token for event */
struct H5ES_event_t *prev, *next; /* Previous and next event nodes */
- /* Useful info for debugging and error reporting */
- const char *api_name; /* Name of API routine for event */
- const char *api_args; /* Arguments to API routine */
- const char *app_file; /* Name of source file from application */
- const char *app_func; /* Name of source function from application */
- unsigned app_line; /* Line # of source file from application */
- uint64_t ev_count; /* This event is the n'th operation in the event set */
- uint64_t ev_time; /* Timestamp for this event (in ms from UNIX epoch) */
+ H5ES_op_info_t op_info; /* Useful info about operation */
} H5ES_event_t;
/* Typedef for lists of event set operations */
@@ -61,7 +54,11 @@ typedef struct H5ES_event_list_t {
/* Typedef for event set objects */
struct H5ES_t {
- uint64_t op_counter; /* Count of operations inserted into this set */
+ uint64_t op_counter; /* Count of operations inserted into this set */
+ H5ES_event_insert_func_t ins_func; /* Callback to invoke for operation inserts */
+ void * ins_ctx; /* Context for callback to invoke for operation inserts */
+ H5ES_event_complete_func_t comp_func; /* Callback to invoke for operation completions */
+ void * comp_ctx; /* Context for callback to invoke for operation inserts */
/* Active events */
H5ES_event_list_t active; /* List of active events in set */
@@ -82,10 +79,11 @@ typedef int (*H5ES_list_iter_func_t)(H5ES_event_t *ev, void *ctx);
/* Package Private Prototypes */
/******************************/
H5_DLL H5ES_t *H5ES__create(void);
+H5_DLL herr_t H5ES__insert_request(H5ES_t *es, H5VL_t *connector, void *token);
H5_DLL herr_t H5ES__wait(H5ES_t *es, uint64_t timeout, size_t *num_in_progress, hbool_t *op_failed);
+H5_DLL herr_t H5ES__cancel(H5ES_t *es, size_t *num_not_canceled, hbool_t *op_failed);
H5_DLL herr_t H5ES__get_err_info(H5ES_t *es, size_t num_err_info, H5ES_err_info_t err_info[],
size_t *num_cleared);
-H5_DLL herr_t H5ES__close(H5ES_t *es);
/* Event list operations */
H5_DLL void H5ES__list_append(H5ES_event_list_t *el, H5ES_event_t *ev);
diff --git a/src/H5ESprivate.h b/src/H5ESprivate.h
index 4f843ba..3d9ce9f 100644
--- a/src/H5ESprivate.h
+++ b/src/H5ESprivate.h
@@ -24,8 +24,9 @@
#ifndef H5ESprivate_H
#define H5ESprivate_H
-/* Include package's public header */
-#include "H5ESpublic.h" /* Event Sets */
+/* Include package's public headers */
+#include "H5ESpublic.h"
+#include "H5ESdevelop.h"
/* Private headers needed by this file */
#include "H5VLprivate.h" /* Virtual Object Layer */
diff --git a/src/H5ESpublic.h b/src/H5ESpublic.h
index 409282c..c8696b3 100644
--- a/src/H5ESpublic.h
+++ b/src/H5ESpublic.h
@@ -42,24 +42,49 @@
/* Asynchronous operation status */
typedef enum H5ES_status_t {
- H5ES_STATUS_IN_PROGRESS, /* Operation(s) have not yet completed */
- H5ES_STATUS_SUCCEED, /* Operation(s) have completed, successfully */
- H5ES_STATUS_FAIL /* An operation has completed, but failed */
+ H5ES_STATUS_IN_PROGRESS, /* Operation(s) have not yet completed */
+ H5ES_STATUS_SUCCEED, /* Operation(s) have completed, successfully */
+ H5ES_STATUS_CANCELED, /* Operation(s) has been canceled */
+ H5ES_STATUS_FAIL /* An operation has completed, but failed */
} H5ES_status_t;
+/* Information about operations in an event set */
+typedef struct H5ES_op_info_t {
+ /* API call info */
+ const char *api_name; /* Name of HDF5 API routine called */
+ char * api_args; /* "Argument string" for arguments to HDF5 API routine called */
+
+ /* Application info */
+ const char *app_file_name; /* Name of source file where the HDF5 API routine was called */
+ const char *app_func_name; /* Name of function where the HDF5 API routine was called */
+ unsigned app_line_num; /* Line # of source file where the HDF5 API routine was called */
+
+ /* Operation info */
+ uint64_t op_ins_count; /* Counter of operation's insertion into event set */
+ uint64_t op_ins_ts; /* Timestamp for when the operation was inserted into the event set */
+ uint64_t op_exec_ts; /* Timestamp for when the operation began execution */
+ uint64_t op_exec_time; /* Execution time for operation (in ns) */
+} H5ES_op_info_t;
+
//! <!-- [H5ES_err_info_t_snip] -->
/**
* Information about failed operations in event set
*/
typedef struct H5ES_err_info_t {
- /* Operation info */
- char * api_name; /**< Name of HDF5 API routine called */
- char * api_args; /**< "Argument string" for arguments to HDF5 API routine called */
+ /* API call info */
+ char *api_name; /**< Name of HDF5 API routine called */
+ char *api_args; /**< "Argument string" for arguments to HDF5 API routine called */
+
+ /* Application info */
char * app_file_name; /**< Name of source file where the HDF5 API routine was called */
char * app_func_name; /**< Name of function where the HDF5 API routine was called */
unsigned app_line_num; /**< Line # of source file where the HDF5 API routine was called */
- uint64_t op_ins_count; /**< Counter of operation's insertion into event set */
- uint64_t op_ins_ts; /**< Timestamp for when the operation was inserted into the event set */
+
+ /* Operation info */
+ uint64_t op_ins_count; /**< Counter of operation's insertion into event set */
+ uint64_t op_ins_ts; /**< Timestamp for when the operation was inserted into the event set */
+ uint64_t op_exec_ts; /**< Timestamp for when the operation began execution */
+ uint64_t op_exec_time; /**< Execution time for operation (in ns) */
/* Error info */
hid_t err_stack_id; /**< ID for error stack from failed operation */
@@ -67,25 +92,11 @@ typedef struct H5ES_err_info_t {
//! <!-- [H5ES_err_info_t_snip] -->
/*
-H5ES_op_info_t:
- const char *: API name (H5Dwrite_async, ...)
- const char *: Arg string
- const char *: Appl. source file name
- const char *: Appl. source function
- unsigned: Appl. source file line
- uint64_t: Insert Time Timestamp
- uint64_t: "event count" - n'th event inserted into event set
- uint64_t: Execution Time timestamp (*)
-
More Possible Info for H5ES_op_info_t:
Parent Operation's request token (*) -> "parent event count"? -- Could be
used to "prune" child operations from reported errors, with flag
to H5ESget_err_info?
-H5ES_err_info_t:
- H5ES_op_info_t: (above)
- hid_t: Error stack (*)
-
Possible debugging routines: (Should also be configured from Env Var)
H5ESdebug_signal(hid_t es_id, signal_t sig, uint64_t <event count>);
H5ESdebug_err_trace_log(hid_t es_id, const char *filename);
@@ -102,15 +113,12 @@ Possible debugging routines: (Should also be configured from Env Var)
How to Trace Async Operations?
<Example of stacking Logging VOL Connector w/Async VOL Connector>
-"Library / wrapper developer" version of API routines: (Auto-generated)
- H5Dwrite_async_wrap(const char *app_file, const char *app_func,
- unsigned app_line_num, dset_id, mem_type_id, mem_space_id, ..., es_id);
-
- vs.
-
- H5Dwrite_async(dset_id, mem_type_id, mem_space_id, ..., es_id);
*/
+typedef int (*H5ES_event_insert_func_t)(const H5ES_op_info_t *op_info, void *ctx);
+typedef int (*H5ES_event_complete_func_t)(const H5ES_op_info_t *op_info, H5ES_status_t status,
+ hid_t err_stack, void *ctx);
+
/********************/
/* Public Variables */
/********************/
@@ -170,6 +178,7 @@ H5_DLL hid_t H5EScreate(void);
*
*/
H5_DLL herr_t H5ESwait(hid_t es_id, uint64_t timeout, size_t *num_in_progress, hbool_t *err_occurred);
+H5_DLL herr_t H5EScancel(hid_t es_id, size_t *num_not_canceled, hbool_t *err_occurred);
/**
* \ingroup H5ES
@@ -260,6 +269,9 @@ H5_DLL herr_t H5ESget_err_count(hid_t es_id, size_t *num_errs);
*/
H5_DLL herr_t H5ESget_err_info(hid_t es_id, size_t num_err_info, H5ES_err_info_t err_info[],
size_t *err_cleared);
+H5_DLL herr_t H5ESfree_err_info(size_t num_err_info, H5ES_err_info_t err_info[]);
+H5_DLL herr_t H5ESregister_insert_func(hid_t es_id, H5ES_event_insert_func_t func, void *ctx);
+H5_DLL herr_t H5ESregister_complete_func(hid_t es_id, H5ES_event_complete_func_t func, void *ctx);
/**
* \ingroup H5ES
diff --git a/src/H5Eint.c b/src/H5Eint.c
index 3fd4099..6438cd9 100644
--- a/src/H5Eint.c
+++ b/src/H5Eint.c
@@ -129,7 +129,7 @@ H5E__get_msg(const H5E_msg_t *msg, H5E_type_t *type, char *msg_str, size_t size)
/* Copy the message into the user's buffer, if given */
if (msg_str) {
- HDstrncpy(msg_str, msg->msg, MIN((size_t)(len + 1), size));
+ HDstrncpy(msg_str, msg->msg, size);
if ((size_t)len >= size)
msg_str[size - 1] = '\0';
} /* end if */
@@ -772,11 +772,12 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line
if (H5I_inc_ref(min_id, FALSE) < 0)
HGOTO_DONE(FAIL)
estack->slot[estack->nused].min_num = min_id;
- if (NULL == (estack->slot[estack->nused].func_name = H5MM_xstrdup(func)))
- HGOTO_DONE(FAIL)
- if (NULL == (estack->slot[estack->nused].file_name = H5MM_xstrdup(file)))
- HGOTO_DONE(FAIL)
- estack->slot[estack->nused].line = line;
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ estack->slot[estack->nused].func_name = func;
+ estack->slot[estack->nused].file_name = file;
+ estack->slot[estack->nused].line = line;
if (NULL == (estack->slot[estack->nused].desc = H5MM_xstrdup(desc)))
HGOTO_DONE(FAIL)
estack->nused++;
@@ -826,10 +827,11 @@ H5E__clear_entries(H5E_t *estack, size_t nentries)
HGOTO_ERROR(H5E_ERROR, H5E_CANTDEC, FAIL, "unable to decrement ref count on error class")
/* Release strings */
- if (error->func_name)
- error->func_name = (const char *)H5MM_xfree_const(error->func_name);
- if (error->file_name)
- error->file_name = (const char *)H5MM_xfree_const(error->file_name);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ error->func_name = NULL;
+ error->file_name = NULL;
if (error->desc)
error->desc = (const char *)H5MM_xfree_const(error->desc);
}
diff --git a/src/H5Emodule.h b/src/H5Emodule.h
index 43d5d36..58a3517 100644
--- a/src/H5Emodule.h
+++ b/src/H5Emodule.h
@@ -29,33 +29,54 @@
#define H5_MY_PKG_ERR H5E_ERROR
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5E H5E
- * \brief Error Handling Interface
- *
- * \details The Error interface provides error handling in the form of a stack.
- * The \Code{FUNC_ENTER} macro clears the error stack whenever an
- * interface function is entered. When an error is detected, an entry
- * is pushed onto the stack. As the functions unwind, additional
- * entries are pushed onto the stack. The API function will return some
- * indication that an error occurred and the application can print the
- * error stack.
- *
- * Certain API functions in the \c H5E package, such as H5Eprint1(), do
- * not clear the error stack. Otherwise, any function which does not
- * have an underscore immediately after the package name will clear the
- * error stack. For instance, H5Fopen() clears the error stack while
- * \Code{H5F_open} does not.
- *
- * An error stack has a fixed maximum size. If this size is exceeded
- * then the stack will be truncated and only the inner-most functions
- * will have entries on the stack. This is expected to be a rare
- * condition.
- *
- * Each thread has its own error stack, but since multi-threading has
- * not been added to the library yet, this package maintains a single
- * error stack. The error stack is statically allocated to reduce the
- * complexity of handling errors within the \c H5E package.
+/**\defgroup H5E H5E
+ *
+ * Use the functions in this module to manage HDF5 error stacks and error
+ * messages.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5E_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5E_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5E_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5E_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \internal The \c FUNC_ENTER macro clears the error stack whenever an
+ * interface function is entered. When an error is detected, an entry
+ * is pushed onto the stack. As the functions unwind, additional
+ * entries are pushed onto the stack. The API function will return
+ * some indication that an error occurred and the application can
+ * print the error stack.
+ *
+ * \internal Certain API functions in the \ref H5E package, such as H5Eprint(),
+ * do not clear the error stack. Otherwise, any function which does
+ * not have an underscore immediately after the package name will
+ * clear the error stack. For instance, H5Fopen() clears the error
+ * stack while \Code{H5F_open} does not.
+ *
+ * \internal An error stack has a fixed maximum size. If this size is exceeded
+ * then the stack will be truncated and only the inner-most functions
+ * will have entries on the stack. This is expected to be a rare
+ * condition.
+ *
+ * \internal Each thread has its own error stack, but since multi-threading has
+ * not been added to the library yet, this package maintains a single
+ * error stack. The error stack is statically allocated to reduce the
+ * complexity of handling errors within the \ref H5E package.
+ *
*/
#endif /* H5Emodule_H */
diff --git a/src/H5Epublic.h b/src/H5Epublic.h
index 0294023..9dfd1fc 100644
--- a/src/H5Epublic.h
+++ b/src/H5Epublic.h
@@ -716,12 +716,13 @@ typedef herr_t (*H5E_auto1_t)(void *client_data);
*
* \return \herr_t
*
+ * \deprecated 1.8.0 Function H5Eclear() renamed to H5Eclear1() and deprecated
+ * in this release.
+ *
* \details H5Eclear1() clears the error stack for the current thread.\n
* The stack is also cleared whenever an API function is called, with
* certain exceptions (for instance, H5Eprint1()).
*
- * \deprecated 1.8.0 Function H5Eclear() renamed to H5Eclear1() and deprecated
- * in this release.
*/
H5_DLL herr_t H5Eclear1(void);
/**
@@ -737,6 +738,9 @@ H5_DLL herr_t H5Eclear1(void);
* function
* \return \herr_t
*
+ * \deprecated 1.8.0 Function H5Eget_auto() renamed to H5Eget_auto1() and
+ * deprecated in this release.
+ *
* \details H5Eget_auto1() returns the current settings for the automatic error
* stack traversal function, \p func, and its data,
* \p client_data. Either or both arguments may be \c NULL, in which case the
@@ -763,8 +767,6 @@ H5_DLL herr_t H5Eclear1(void);
* H5Eprint2(), mixing H5Eset_auto1() and H5Eget_auto2() or mixing
* H5Eset_auto2() and H5Eget_auto1() does not fail.
*
- * \deprecated 1.8.0 Function H5Eget_auto() renamed to H5Eget_auto1() and
- * deprecated in this release.
*/
H5_DLL herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data);
/**
@@ -781,6 +783,9 @@ H5_DLL herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data);
* \param[in] str Error description string
* \return \herr_t
*
+ * \deprecated 1.8.0 Function H5Epush() renamed to H5Epush1() and
+ * deprecated in this release.
+ *
* \details H5Epush1() pushes a new error record onto the error stack for the
* current thread.\n
* The error has major and minor numbers \p maj_num
@@ -791,8 +796,6 @@ H5_DLL herr_t H5Eget_auto1(H5E_auto1_t *func, void **client_data);
* allocated.
*
* \since 1.4.0
- * \deprecated 1.8.0 Function H5Epush() renamed to H5Epush1() and
- * deprecated in this release.
*/
H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_major_t maj, H5E_minor_t min,
const char *str);
@@ -805,6 +808,9 @@ H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_ma
* \param[in] stream File pointer, or \c NULL for \c stderr
* \return \herr_t
*
+ * \deprecated 1.8.0 Function H5Eprint() renamed to H5Eprint1() and
+ * deprecated in this release.
+ *
* \details H5Eprint1() prints prints the error stack for the current thread
* on the specified stream, \p stream. Even if the error stack is empty, a
* one-line message of the following form will be printed:
@@ -815,8 +821,6 @@ H5_DLL herr_t H5Epush1(const char *file, const char *func, unsigned line, H5E_ma
* that prints error messages. Users are encouraged to write their own
* more specific error handlers.
*
- * \deprecated 1.8.0 Function H5Eprint() renamed to H5Eprint1() and
- * deprecated in this release.
*/
H5_DLL herr_t H5Eprint1(FILE *stream);
/**
@@ -829,6 +833,9 @@ H5_DLL herr_t H5Eprint1(FILE *stream);
* \param[in] client_data Data passed to the error function
* \return \herr_t
*
+ * \deprecated 1.8.0 Function H5Eset_auto() renamed to H5Eset_auto1() and
+ * deprecated in this release.
+ *
* \details H5Eset_auto1() turns on or off automatic printing of errors. When
* turned on (non-null \p func pointer), any API function which returns
* an error indication will first call \p func, passing it \p
@@ -845,8 +852,6 @@ H5_DLL herr_t H5Eprint1(FILE *stream);
* Automatic stack traversal is always in the #H5E_WALK_DOWNWARD
* direction.
*
- * \deprecated 1.8.0 Function H5Eset_auto() renamed to H5Eset_auto1() and
- * deprecated in this release.
*/
H5_DLL herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data);
/**
@@ -860,6 +865,9 @@ H5_DLL herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data);
* \param[in] client_data Data to be passed to \p func
* \return \herr_t
*
+ * \deprecated 1.8.0 Function H5Ewalk() renamed to H5Ewalk1() and
+ * deprecated in this release.
+ *
* \details H5Ewalk1() walks the error stack for the current thread and calls
* the function specified in \p func for each error along the way.
*
@@ -877,8 +885,6 @@ H5_DLL herr_t H5Eset_auto1(H5E_auto1_t func, void *client_data);
* is as follows:
* \snippet this H5E_walk1_t_snip
*
- * \deprecated 1.8.0 Function H5Ewalk() renamed to H5Ewalk1() and
- * deprecated in this release.
*/
H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data);
/**
@@ -891,6 +897,8 @@ H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client
* \param[in] maj Major error number
* \return \herr_t
*
+ * \deprecated 1.8.0 Function deprecated in this release.
+ *
* \details Given a major error number, H5Eget_major() returns a constant
* character string that describes the error.
*
@@ -898,7 +906,6 @@ H5_DLL herr_t H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client
* array). An application calling this function must free the memory
* associated with the return value to prevent a memory leak.
*
- * \deprecated 1.8.0 Function deprecated in this release.
*/
H5_DLL char *H5Eget_major(H5E_major_t maj);
/**
@@ -911,6 +918,8 @@ H5_DLL char *H5Eget_major(H5E_major_t maj);
* \param[in] min Minor error number
* \return \herr_t
*
+ * \deprecated 1.8.0 Function deprecated and return type changed in this release.
+ *
* \details Given a minor error number, H5Eget_minor() returns a constant
* character string that describes the error.
*
@@ -920,7 +929,6 @@ H5_DLL char *H5Eget_major(H5E_major_t maj);
* the memory associated with the return value to prevent a memory
* leak. This is a change from the 1.6.x release series.
*
- * \deprecated 1.8.0 Function deprecated and return type changed in this release.
*/
H5_DLL char *H5Eget_minor(H5E_minor_t min);
#endif /* H5_NO_DEPRECATED_SYMBOLS */
diff --git a/src/H5F.c b/src/H5F.c
index 0baf399..46c8c0e 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -112,8 +112,9 @@ H5FL_EXTERN(H5VL_object_t);
hid_t
H5Fget_create_plist(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_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", file_id);
@@ -122,10 +123,17 @@ H5Fget_create_plist(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_FCPL;
+ vol_cb_args.args.get_fcpl.fcpl_id = H5I_INVALID_HID;
+
/* Retrieve the file creation property list */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_FCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCOPY, H5I_INVALID_HID, "unable to retrieve file creation properties")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_fcpl.fcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_create_plist() */
@@ -151,8 +159,9 @@ done:
hid_t
H5Fget_access_plist(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_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", file_id);
@@ -161,10 +170,17 @@ H5Fget_access_plist(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_FAPL;
+ vol_cb_args.args.get_fapl.fapl_id = H5I_INVALID_HID;
+
/* Retrieve the file's access property list */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_FAPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't get file access property list")
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_fapl.fapl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_access_plist() */
@@ -222,16 +238,25 @@ H5Fget_obj_count(hid_t file_id, unsigned types)
* count the IDs in the file.
*/
if (file_id != (hid_t)H5F_OBJ_ALL) {
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj; /* File for file_id */
+ size_t count = 0; /* Object count */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get the file object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a file id")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_OBJ_COUNT;
+ vol_cb_args.args.get_obj_count.types = types;
+ vol_cb_args.args.get_obj_count.count = &count;
+
/* Get the count */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_COUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types,
- &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object count in file(s)")
+
+ /* Set return value */
+ ret_value = (ssize_t)count;
}
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
@@ -333,16 +358,27 @@ H5Fget_obj_ids(hid_t file_id, unsigned types, size_t max_objs, hid_t *oid_list /
* get the IDs from the file.
*/
if (file_id != (hid_t)H5F_OBJ_ALL) {
- H5VL_object_t *vol_obj;
+ H5VL_object_t * vol_obj; /* File for file_id */
+ size_t count = 0; /* Object count */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* get the file object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_OBJ_IDS;
+ vol_cb_args.args.get_obj_ids.types = types;
+ vol_cb_args.args.get_obj_ids.max_objs = max_objs;
+ vol_cb_args.args.get_obj_ids.oid_list = oid_list;
+ vol_cb_args.args.get_obj_ids.count = &count;
+
/* Get the IDs */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_OBJ_IDS, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, types,
- max_objs, oid_list, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get object ids in file(s)")
+
+ /* Set return value */
+ ret_value = (ssize_t)count;
} /* end if */
/* If we passed in the 'special' ID, get the count for everything open in the
* library, iterating over all open files and getting the object count for each.
@@ -396,8 +432,10 @@ done:
herr_t
H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iix", file_id, fapl_id, file_handle);
@@ -410,9 +448,14 @@ H5Fget_vfd_handle(hid_t file_id, hid_t fapl_id, void **file_handle /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_vfd_handle.fapl_id = fapl_id;
+ file_opt_args.get_vfd_handle.file_handle = file_handle;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_VFD_HANDLE;
+ vol_cb_args.args = &file_opt_args;
+
/* Retrieve the VFD handle for the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_VFD_HANDLE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, file_handle, fapl_id) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get VFD handle")
done:
@@ -432,7 +475,9 @@ done:
htri_t
H5Fis_accessible(const char *filename, hid_t fapl_id)
{
- htri_t ret_value; /* Return value */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("t", "*si", filename, fapl_id);
@@ -447,11 +492,19 @@ H5Fis_accessible(const char *filename, hid_t fapl_id)
else if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not file access property list")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = filename;
+ vol_cb_args.args.is_accessible.fapl_id = fapl_id;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
/* Check if file is accessible */
- if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id,
- filename, &ret_value) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
+ /* Set return value */
+ ret_value = (htri_t)is_accessible;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fis_accessible() */
@@ -477,10 +530,17 @@ H5F__post_open_api_common(H5VL_object_t *vol_obj, void **token_ptr)
supported = 0;
if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't check for 'post open' operation")
- if (supported & H5VL_OPT_QUERY_SUPPORTED)
+ if (supported & H5VL_OPT_QUERY_SUPPORTED) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN;
+ vol_cb_args.args = NULL;
+
/* Make the 'post open' callback */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to make file 'post open' callback")
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -870,8 +930,9 @@ H5F__flush_api_common(hid_t object_id, H5F_scope_t scope, void **token_ptr, H5VL
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 */
- H5I_type_t obj_type; /* Type of object to use */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5I_type_t obj_type; /* Type of object to use */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -885,9 +946,13 @@ H5F__flush_api_common(hid_t object_id, H5F_scope_t scope, void **token_ptr, H5VL
if (NULL == (*vol_obj_ptr = H5VL_vol_object(object_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_FLUSH;
+ vol_cb_args.args.flush.obj_type = obj_type;
+ vol_cb_args.args.flush.scope = scope;
+
/* Flush the object */
- if (H5VL_file_specific(*vol_obj_ptr, H5VL_FILE_FLUSH, H5P_DATASET_XFER_DEFAULT, token_ptr, (int)obj_type,
- (int)scope) < 0)
+ if (H5VL_file_specific(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTFLUSH, FAIL, "unable to flush file")
done:
@@ -1072,10 +1137,11 @@ done:
herr_t
H5Fdelete(const char *filename, hid_t fapl_id)
{
- H5P_genplist_t * plist; /* Property list pointer */
- H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- htri_t is_hdf5 = FAIL;
- herr_t ret_value = SUCCEED;
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "*si", filename, fapl_id);
@@ -1100,16 +1166,25 @@ H5Fdelete(const char *filename, hid_t fapl_id)
if (H5CX_set_vol_connector_prop(&connector_prop) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set VOL connector info in API context")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = filename;
+ vol_cb_args.args.is_accessible.fapl_id = fapl_id;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
/* Make sure this is HDF5 storage for this VOL connector */
- if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id,
- filename, &is_hdf5) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "unable to determine if file is accessible as HDF5")
- if (!is_hdf5)
+ if (!is_accessible)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, FAIL, "not an HDF5 file")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_DELETE;
+ vol_cb_args.args.del.filename = filename;
+ vol_cb_args.args.del.fapl_id = fapl_id;
+
/* Delete the file */
- if (H5VL_file_specific(NULL, H5VL_FILE_DELETE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, fapl_id,
- filename, &ret_value) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTDELETEFILE, FAIL, "unable to delete the file")
done:
@@ -1129,11 +1204,13 @@ done:
herr_t
H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
{
- H5VL_object_t *loc_vol_obj = NULL; /* Parent object */
- H5VL_object_t *child_vol_obj = NULL; /* Child object */
- H5I_type_t loc_type; /* ID type of location */
- H5I_type_t child_type; /* ID type of child */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * loc_vol_obj = NULL; /* Parent object */
+ H5VL_object_t * child_vol_obj = NULL; /* Child object */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ void * grp = NULL; /* Root group opened */
+ H5I_type_t loc_type; /* ID type of location */
+ int same_connector = 0; /* Whether parent and child files use the same connector */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sii", loc_id, name, child_id, plist_id);
@@ -1146,8 +1223,7 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be NULL")
if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be the empty string")
- child_type = H5I_get_type(child_id);
- if (H5I_FILE != child_type)
+ if (H5I_FILE != H5I_get_type(child_id))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "child_id parameter not a file ID")
if (H5P_DEFAULT == plist_id)
plist_id = H5P_FILE_MOUNT_DEFAULT;
@@ -1159,23 +1235,71 @@ H5Fmount(hid_t loc_id, const char *name, hid_t child_id, hid_t plist_id)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Get the location object */
- if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+ /* Need to open the root group of a file, if a file ID was given as the
+ * 'loc_id', because the 'mount' operation is a group specific operation.
+ */
+ if (H5I_FILE == loc_type) {
+ H5VL_object_t * vol_obj; /* Object for loc_id (file) */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+
+ /* Get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = loc_type;
+
+ /* Open the root group object */
+ if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, "/", H5P_GROUP_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+
+ /* Create a VOL object for the root group */
+ if (NULL == (loc_vol_obj = H5VL_create_object(grp, vol_obj->connector)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group")
+ } /* end if */
+ else {
+ HDassert(H5I_GROUP == loc_type);
+ if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+ } /* end else */
/* Get the child object */
if (NULL == (child_vol_obj = (H5VL_object_t *)H5I_object(child_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get child object")
/* Check if both objects are associated with the same VOL connector */
- if (loc_vol_obj->connector->cls->value != child_vol_obj->connector->cls->value)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "Can't mount file onto object from different VOL connector")
+ if (H5VL_cmp_connector_cls(&same_connector, loc_vol_obj->connector->cls, child_vol_obj->connector->cls) <
+ 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "can't mount file onto object from different VOL connector")
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_MOUNT;
+ vol_cb_args.args.mount.name = name;
+ vol_cb_args.args.mount.child_file =
+ child_vol_obj->data; /* Don't unwrap fully, so each connector can see its object */
+ vol_cb_args.args.mount.fmpl_id = plist_id;
/* Perform the mount operation */
- if (H5VL_file_specific(loc_vol_obj, H5VL_FILE_MOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- (int)loc_type, name, child_vol_obj->data, plist_id) < 0)
+ /* (This is on a group, so that the VOL framework always sees groups for
+ * the 'mount' operation, instead of mixing files and groups)
+ */
+ if (H5VL_group_specific(loc_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
done:
+ /* Clean up if we temporarily opened the root group for a file */
+ if (grp) {
+ HDassert(loc_vol_obj);
+ if (H5VL_group_close(loc_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group")
+ if (H5VL_free_object(loc_vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* end H5Fmount() */
@@ -1198,9 +1322,11 @@ done:
herr_t
H5Funmount(hid_t loc_id, const char *name)
{
- H5VL_object_t *vol_obj = NULL; /* Parent object */
- H5I_type_t loc_type; /* ID type of location */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * loc_vol_obj = NULL; /* Parent object */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ void * grp = NULL; /* Root group opened */
+ H5I_type_t loc_type; /* ID type of location */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*s", loc_id, name);
@@ -1219,15 +1345,57 @@ H5Funmount(hid_t loc_id, const char *name)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
/* Get the location object */
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+ /* Need to open the root group of a file, if a file ID was given as the
+ * 'loc_id', because the 'mount' operation is a group specific operation.
+ */
+ if (H5I_FILE == loc_type) {
+ H5VL_object_t * vol_obj; /* Object for loc_id (file) */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+
+ /* Get the location object */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5VL_vol_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+
+ /* Set location parameters */
+ loc_params.type = H5VL_OBJECT_BY_SELF;
+ loc_params.obj_type = loc_type;
+
+ /* Open the root group object */
+ if (NULL == (grp = H5VL_group_open(vol_obj, &loc_params, "/", H5P_GROUP_ACCESS_DEFAULT,
+ H5P_DATASET_XFER_DEFAULT, NULL)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "unable to open group")
+
+ /* Create a VOL object for the root group */
+ if (NULL == (loc_vol_obj = H5VL_create_object(grp, vol_obj->connector)))
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENOBJ, FAIL, "can't create VOL object for root group")
+ } /* end if */
+ else {
+ HDassert(H5I_GROUP == loc_type);
+ if (NULL == (loc_vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not get location object")
+ } /* end else */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_UNMOUNT;
+ vol_cb_args.args.unmount.name = name;
/* Perform the unmount operation */
- if (H5VL_file_specific(vol_obj, H5VL_FILE_UNMOUNT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- (int)loc_type, name) < 0)
+ /* (This is on a group, so that the VOL framework always sees groups for
+ * the 'unmount' operation, instead of mixing files and groups)
+ */
+ if (H5VL_group_specific(loc_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to unmount file")
done:
+ /* Clean up if we temporarily opened the root group for a file */
+ if (grp) {
+ HDassert(loc_vol_obj);
+ if (H5VL_group_close(loc_vol_obj, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CLOSEERROR, FAIL, "unable to release group")
+ if (H5VL_free_object(loc_vol_obj) < 0)
+ HDONE_ERROR(H5E_FILE, H5E_CANTDEC, FAIL, "unable to free VOL object")
+ } /* end if */
+
FUNC_LEAVE_API(ret_value)
} /* end H5Funmount() */
@@ -1245,9 +1413,10 @@ done:
static hid_t
H5F__reopen_api_common(hid_t file_id, void **token_ptr)
{
- void * file = NULL; /* File struct for new file */
- H5VL_object_t *vol_obj = NULL; /* Object for loc_id */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ void * reopen_file = NULL; /* Pointer to the re-opened file object */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -1255,16 +1424,20 @@ H5F__reopen_api_common(hid_t file_id, void **token_ptr)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_REOPEN;
+ vol_cb_args.args.reopen.file = &reopen_file;
+
/* Reopen the file */
- if (H5VL_file_specific(vol_obj, H5VL_FILE_REOPEN, H5P_DATASET_XFER_DEFAULT, token_ptr, &file) < 0)
+ if (H5VL_file_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file via the VOL connector")
/* Make sure that worked */
- if (NULL == file)
+ if (NULL == reopen_file)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, H5I_INVALID_HID, "unable to reopen file")
/* Get an ID for the file */
- if ((ret_value = H5VL_register(H5I_FILE, file, vol_obj->connector, TRUE)) < 0)
+ if ((ret_value = H5VL_register(H5I_FILE, reopen_file, vol_obj->connector, TRUE)) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register file handle")
done:
@@ -1398,15 +1571,19 @@ H5Fget_intent(hid_t file_id, unsigned *intent_flags /*out*/)
/* If no intent flags were passed in, exit quietly */
if (intent_flags) {
- H5VL_object_t *vol_obj; /* File info */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get the internal file structure */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_INTENT;
+ vol_cb_args.args.get_intent.flags = intent_flags;
+
/* Get the flags */
- if ((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_INTENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, intent_flags)) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's intent flags")
} /* end if */
@@ -1434,15 +1611,19 @@ H5Fget_fileno(hid_t file_id, unsigned long *fnumber /*out*/)
/* If no fnumber pointer was passed in, exit quietly */
if (fnumber) {
- H5VL_object_t *vol_obj; /* File info */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get the internal file structure */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- /* Get the flags */
- if ((ret_value = H5VL_file_get(vol_obj, H5VL_FILE_GET_FILENO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, fnumber)) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_FILENO;
+ vol_cb_args.args.get_fileno.fileno = fnumber;
+
+ /* Get the 'file number' */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file's 'file number'")
} /* end if */
@@ -1462,8 +1643,11 @@ done:
hssize_t
H5Fget_freespace(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL;
- hssize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ hsize_t file_freespace = 0; /* Size of freespace in the file */
+ hssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("Hs", "i", file_id);
@@ -1472,11 +1656,18 @@ H5Fget_freespace(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_freespace.size = &file_freespace;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_FREE_SPACE;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the amount of free space in the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SPACE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free space")
+ /* Set return value */
+ ret_value = (hssize_t)file_freespace;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_freespace() */
@@ -1495,8 +1686,10 @@ done:
herr_t
H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, size);
@@ -1507,9 +1700,13 @@ H5Fget_filesize(hid_t file_id, hsize_t *size /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_size.size = size;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_SIZE;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file size */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- size) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
done:
@@ -1556,8 +1753,11 @@ done:
ssize_t
H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len)
{
- H5VL_object_t *vol_obj; /* File object for file ID */
- ssize_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* File object for file ID */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ size_t image_len = 0; /* Size of image buffer */
+ ssize_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", file_id, buf, buf_len);
@@ -1566,11 +1766,20 @@ H5Fget_file_image(hid_t file_id, void *buf /*out*/, size_t buf_len)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_file_image.buf_size = buf_len;
+ file_opt_args.get_file_image.buf = buf;
+ file_opt_args.get_file_image.image_len = &image_len;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_FILE_IMAGE;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file image */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FILE_IMAGE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, buf, &ret_value, buf_len) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file image")
+ /* Set return value */
+ ret_value = (ssize_t)image_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_file_image() */
@@ -1592,8 +1801,10 @@ done:
herr_t
H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, config);
@@ -1606,9 +1817,13 @@ H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_config.config = config;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_CONF;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the metadata cache configuration */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_CONF, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- config) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get metadata cache configuration")
done:
@@ -1627,10 +1842,12 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
+H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "i*Cc", file_id, config_ptr);
@@ -1639,9 +1856,13 @@ H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.set_mdc_config.config = config_ptr;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_MDC_CONFIG;
+ vol_cb_args.args = &file_opt_args;
+
/* Set the metadata cache configuration */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MDC_CONFIG, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, config_ptr) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set metadata cache configuration")
done:
@@ -1663,8 +1884,10 @@ done:
herr_t
H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/)
{
- H5VL_object_t *vol_obj;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, hit_rate);
@@ -1675,9 +1898,13 @@ H5Fget_mdc_hit_rate(hid_t file_id, double *hit_rate /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_hit_rate.hit_rate = hit_rate;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_HR;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the current hit rate */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_HR, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- hit_rate) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC hit rate")
done:
@@ -1701,8 +1928,11 @@ herr_t
H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size /*out*/,
size_t *cur_size /*out*/, int *cur_num_entries /*out*/)
{
- H5VL_object_t *vol_obj;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ uint32_t index_len = 0; /* Size of cache index */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ixxxx", file_id, max_size, min_clean_size, cur_size, cur_num_entries);
@@ -1711,11 +1941,22 @@ H5Fget_mdc_size(hid_t file_id, size_t *max_size /*out*/, size_t *min_clean_size
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_size.max_size = max_size;
+ file_opt_args.get_mdc_size.min_clean_size = min_clean_size;
+ file_opt_args.get_mdc_size.cur_size = cur_size;
+ file_opt_args.get_mdc_size.cur_num_entries = &index_len;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_SIZE;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the size data */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_SIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- max_size, min_clean_size, cur_size, cur_num_entries) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MDC size")
+ /* Set mis-matched return value */
+ if (cur_num_entries)
+ *cur_num_entries = (int)index_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* H5Fget_mdc_size() */
@@ -1739,8 +1980,9 @@ done:
herr_t
H5Freset_mdc_hit_rate_stats(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ 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", file_id);
@@ -1749,9 +1991,12 @@ H5Freset_mdc_hit_rate_stats(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE;
+ vol_cb_args.args = NULL;
+
/* Reset the hit rate statistic */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset cache hit rate")
done:
@@ -1780,9 +2025,11 @@ done:
ssize_t
H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size)
{
- H5VL_object_t *vol_obj = NULL;
- H5I_type_t type;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj; /* File for file_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5I_type_t type;
+ size_t file_name_len = 0; /* Length of file name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, name, size);
@@ -1797,11 +2044,20 @@ H5Fget_name(hid_t obj_id, char *name /*out*/, size_t size)
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = type;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
/* Get the filename via the VOL */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)type, size,
- name, &ret_value) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file name")
+ /* Set the return value */
+ ret_value = (ssize_t)file_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_name() */
@@ -1822,9 +2078,11 @@ done:
herr_t
H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- H5I_type_t type;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ H5I_type_t type;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", obj_id, finfo);
@@ -1843,9 +2101,14 @@ H5Fget_info2(hid_t obj_id, H5F_info2_t *finfo /*out*/)
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_info.type = type;
+ file_opt_args.get_info.finfo = finfo;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file information */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- (int)type, finfo) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
done:
@@ -1865,8 +2128,10 @@ done:
herr_t
H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/)
{
- H5VL_object_t *vol_obj = NULL; /* File object for file ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File object for file ID */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, info);
@@ -1879,10 +2144,14 @@ H5Fget_metadata_read_retry_info(hid_t file_id, H5F_retry_info_t *info /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_metadata_read_retry_info.info = info;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the retry info */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, info) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't get metadata read retry info")
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get metadata read retry info")
done:
FUNC_LEAVE_API(ret_value)
@@ -1903,8 +2172,11 @@ done:
ssize_t
H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info_t *sect_info /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ size_t sect_count = 0; /* Number of sections */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE4("Zs", "iFmzx", file_id, type, nsects, sect_info);
@@ -1915,11 +2187,21 @@ H5Fget_free_sections(hid_t file_id, H5F_mem_t type, size_t nsects, H5F_sect_info
if (sect_info && nsects == 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "nsects must be > 0")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_free_sections.type = type;
+ file_opt_args.get_free_sections.sect_info = sect_info;
+ file_opt_args.get_free_sections.nsects = nsects;
+ file_opt_args.get_free_sections.sect_count = &sect_count;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_FREE_SECTIONS;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the free-space section information in the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_FREE_SECTIONS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, sect_info, &ret_value, (int)type, nsects) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file free sections")
+ /* Set return value */
+ ret_value = (ssize_t)sect_count;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fget_free_sections() */
@@ -1938,8 +2220,9 @@ done:
herr_t
H5Fclear_elink_file_cache(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File */
+ 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", file_id);
@@ -1948,9 +2231,12 @@ H5Fclear_elink_file_cache(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "not a file ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE;
+ vol_cb_args.args = NULL;
+
/* Release the EFC */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "can't release external file cache")
done:
@@ -1994,8 +2280,9 @@ done:
herr_t
H5Fstart_swmr_write(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File info */
+ 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", file_id);
@@ -2008,9 +2295,12 @@ H5Fstart_swmr_write(hid_t file_id)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_START_SWMR_WRITE;
+ vol_cb_args.args = NULL;
+
/* Start SWMR writing */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_SWMR_WRITE, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to start SWMR writing")
done:
@@ -2030,8 +2320,9 @@ done:
herr_t
H5Fstart_mdc_logging(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ 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", file_id);
@@ -2040,9 +2331,12 @@ H5Fstart_mdc_logging(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_START_MDC_LOGGING;
+ vol_cb_args.args = NULL;
+
/* Call mdc logging function */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_START_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to start mdc logging")
done:
@@ -2063,8 +2357,9 @@ done:
herr_t
H5Fstop_mdc_logging(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ 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", file_id);
@@ -2073,9 +2368,12 @@ H5Fstop_mdc_logging(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_STOP_MDC_LOGGING;
+ vol_cb_args.args = NULL;
+
/* Call mdc logging function */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_STOP_MDC_LOGGING, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to stop mdc logging")
done:
@@ -2096,8 +2394,10 @@ done:
herr_t
H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *is_currently_logging /*out*/)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", file_id, is_enabled, is_currently_logging);
@@ -2106,9 +2406,14 @@ H5Fget_mdc_logging_status(hid_t file_id, hbool_t *is_enabled /*out*/, hbool_t *i
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_logging_status.is_enabled = is_enabled;
+ file_opt_args.get_mdc_logging_status.is_currently_logging = is_currently_logging;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS;
+ vol_cb_args.args = &file_opt_args;
+
/* Call mdc logging function */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, is_enabled, is_currently_logging) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_LOGGING, FAIL, "unable to get logging status")
done:
@@ -2130,8 +2435,10 @@ done:
herr_t
H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
{
- H5VL_object_t *vol_obj; /* File as VOL object */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File as VOL object */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "iFvFv", file_id, low, high);
@@ -2144,9 +2451,14 @@ H5Fset_libver_bounds(hid_t file_id, H5F_libver_t low, H5F_libver_t high)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ file_opt_args.set_libver_bounds.low = low;
+ file_opt_args.set_libver_bounds.high = high;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS;
+ vol_cb_args.args = &file_opt_args;
+
/* Set the library's version bounds */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, low, high) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
@@ -2167,8 +2479,9 @@ done:
herr_t
H5Fformat_convert(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL; /* File */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File */
+ 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", file_id);
@@ -2181,9 +2494,12 @@ H5Fformat_convert(hid_t file_id)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_FORMAT_CONVERT;
+ vol_cb_args.args = NULL;
+
/* Convert the format */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_FORMAT_CONVERT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCONVERT, FAIL, "can't convert file format")
done:
@@ -2202,8 +2518,9 @@ done:
herr_t
H5Freset_page_buffering_stats(hid_t file_id)
{
- H5VL_object_t *vol_obj; /* File to reset stats on */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File to reset stats on */
+ 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", file_id);
@@ -2212,9 +2529,12 @@ H5Freset_page_buffering_stats(hid_t file_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS;
+ vol_cb_args.args = NULL;
+
/* Reset the statistics */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't reset stats for page buffering")
done:
@@ -2235,8 +2555,10 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne
unsigned misses[2] /*out*/, unsigned evictions[2] /*out*/,
unsigned bypasses[2] /*out*/)
{
- H5VL_object_t *vol_obj; /* File object */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File object */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "ixxxxx", file_id, accesses, hits, misses, evictions, bypasses);
@@ -2247,9 +2569,17 @@ H5Fget_page_buffering_stats(hid_t file_id, unsigned accesses[2] /*out*/, unsigne
if (NULL == accesses || NULL == hits || NULL == misses || NULL == evictions || NULL == bypasses)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL input parameters for stats")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_page_buffering_stats.accesses = accesses;
+ file_opt_args.get_page_buffering_stats.hits = hits;
+ file_opt_args.get_page_buffering_stats.misses = misses;
+ file_opt_args.get_page_buffering_stats.evictions = evictions;
+ file_opt_args.get_page_buffering_stats.bypasses = bypasses;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the statistics */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, accesses, hits, misses, evictions, bypasses) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve stats for page buffering")
done:
@@ -2272,8 +2602,10 @@ done:
herr_t
H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image_len /*out*/)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "ixx", file_id, image_addr, image_len);
@@ -2282,9 +2614,14 @@ H5Fget_mdc_image_info(hid_t file_id, haddr_t *image_addr /*out*/, hsize_t *image
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mdc_image_info.addr = image_addr;
+ file_opt_args.get_mdc_image_info.len = image_len;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Go get the address and size of the cache image */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, image_addr, image_len) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't retrieve cache image info")
done:
@@ -2317,9 +2654,16 @@ H5Fget_eoa(hid_t file_id, haddr_t *eoa /*out*/)
/* Only do work if valid pointer to fill in */
if (eoa) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+
+ /* Set up VOL callback arguments */
+ file_opt_args.get_eoa.eoa = eoa;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_EOA;
+ vol_cb_args.args = &file_opt_args;
+
/* Retrieve the EOA for the file */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_EOA, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- eoa) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get EOA")
} /* end if */
@@ -2339,8 +2683,10 @@ done:
herr_t
H5Fincrement_filesize(hid_t file_id, hsize_t increment)
{
- H5VL_object_t *vol_obj; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ih", file_id, increment);
@@ -2349,9 +2695,13 @@ H5Fincrement_filesize(hid_t file_id, hsize_t increment)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "hid_t identifier is not a file ID")
+ /* Set up VOL callback arguments */
+ file_opt_args.increment_filesize.increment = increment;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_INCR_FILESIZE;
+ vol_cb_args.args = &file_opt_args;
+
/* Increment the file size */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_INCR_FILESIZE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- increment) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to increment file size")
done:
@@ -2371,21 +2721,27 @@ done:
herr_t
H5Fget_dset_no_attrs_hint(hid_t file_id, hbool_t *minimize /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", file_id, minimize);
+ /* Check args */
if (NULL == minimize)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "out pointer 'minimize' cannot be NULL")
-
- vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE);
- if (NULL == vol_obj)
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, minimize) < 0)
+ /* Set up VOL callback arguments */
+ file_opt_args.get_min_dset_ohdr_flag.minimize = minimize;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG;
+ vol_cb_args.args = &file_opt_args;
+
+ /* Get the dataset object header minimum size flag */
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
done:
@@ -2405,18 +2761,25 @@ done:
herr_t
H5Fset_dset_no_attrs_hint(hid_t file_id, hbool_t minimize)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, minimize);
- vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE);
- if (NULL == vol_obj)
+ /* Check args */
+ if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier")
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, minimize) < 0)
+ /* Set up VOL callback arguments */
+ file_opt_args.set_min_dset_ohdr_flag.minimize = minimize;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG;
+ vol_cb_args.args = &file_opt_args;
+
+ /* Set the 'minimize dataset object headers flag' */
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set file's dataset header minimization flag")
done:
@@ -2424,43 +2787,6 @@ done:
} /* H5Fset_dset_no_attrs_hint */
/*-------------------------------------------------------------------------
- * Function: H5Fwait
- *
- * Purpose: Wait for all operations on a dataset.
- * Tang: added for async
- *
- * Return: SUCCEED/FAIL
- *
- *-------------------------------------------------------------------------
- */
-herr_t
-H5Fwait(hid_t file_id)
-{
- H5VL_object_t *vol_obj; /* File for this operation */
- H5I_type_t obj_type; /* Type of object */
- herr_t ret_value = SUCCEED; /* Return value */
-
- FUNC_ENTER_API(FAIL)
- H5TRACE1("e", "i", file_id);
-
- /* Get the type of object we're flushing + sanity check */
- obj_type = H5I_get_type(file_id);
- if (H5I_FILE != obj_type && H5I_GROUP != obj_type && H5I_DATATYPE != obj_type &&
- H5I_DATASET != obj_type && H5I_ATTR != obj_type)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "file_id parameter is not a valid file identifier")
-
- if ((ret_value = H5VL_file_specific(vol_obj, H5VL_FILE_WAIT, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- file_id)) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTOPERATE, FAIL, "unable to wait file")
-
-done:
- FUNC_LEAVE_API(ret_value)
-} /* H5Fwait() */
-
-/*-------------------------------------------------------------------------
* Function: H5Fvfd_swmr_end_tick()
*
* Purpose: To trigger end of tick processing
@@ -2471,8 +2797,9 @@ done:
herr_t
H5Fvfd_swmr_end_tick(hid_t file_id)
{
- H5VL_object_t *vol_obj = NULL; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Note: use the version of FUNC_ENTER_API without EOT processing */
FUNC_ENTER_API_NO_EOT(FAIL)
@@ -2487,8 +2814,11 @@ H5Fvfd_swmr_end_tick(hid_t file_id)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_VFD_SWMR_END_TICK, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_VFD_SWMR_END_TICK;
+ vol_cb_args.args = NULL;
+
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to trigger end of tick processing for VFD SWMR")
done:
@@ -2507,9 +2837,9 @@ done:
herr_t
H5Fvfd_swmr_disable_end_of_tick(hid_t file_id)
{
-
- H5VL_object_t *vol_obj = NULL; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File */
+ 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", file_id);
@@ -2523,8 +2853,11 @@ H5Fvfd_swmr_disable_end_of_tick(hid_t file_id)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_VFD_SWMR_DISABLE_EOT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_VFD_SWMR_DISABLE_EOT;
+ vol_cb_args.args = NULL;
+
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to disable EOT for VFD SWMR")
done:
@@ -2542,9 +2875,9 @@ done:
herr_t
H5Fvfd_swmr_enable_end_of_tick(hid_t file_id)
{
-
- H5VL_object_t *vol_obj = NULL; /* File info */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* File */
+ 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", file_id);
@@ -2558,8 +2891,11 @@ H5Fvfd_swmr_enable_end_of_tick(hid_t file_id)
if (H5CX_set_loc(file_id) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set collective metadata read info")
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_VFD_SWMR_ENABLE_EOT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_VFD_SWMR_ENABLE_EOT;
+ vol_cb_args.args = NULL;
+
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "unable to enable EOT for VFD SWMR")
done:
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index b265e1d..8cf9f9e 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -582,7 +582,7 @@ done:
* memb_name & temp in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("format-nonliteral")
+H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
static H5FD_t *
H5FD__family_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr)
{
@@ -735,7 +735,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5FD__family_open() */
-H5_GCC_DIAG_ON("format-nonliteral")
+H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5FD__family_close
@@ -905,7 +905,7 @@ H5FD__family_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type)
* memb_name in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("format-nonliteral")
+H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
static herr_t
H5FD__family_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t abs_eoa)
{
@@ -974,7 +974,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
}
-H5_GCC_DIAG_ON("format-nonliteral")
+H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5FD__family_get_eof
diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c
index 102a3ab..2c4bff6 100644
--- a/src/H5FDhdfs.c
+++ b/src/H5FDhdfs.c
@@ -1,15 +1,13 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Read-Only HDFS Virtual File Driver (VFD) *
- * Copyright (c) 2018, The HDF Group. *
- * *
+ * Copyright by The HDF Group. *
* All rights reserved. *
* *
- * NOTICE: *
- * All information contained herein is, and remains, the property of The HDF *
- * Group. The intellectual and technical concepts contained herein are *
- * proprietary to The HDF Group. Dissemination of this information or *
- * reproduction of this material is strictly forbidden unless prior written *
- * permission is obtained from The HDF Group. *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
@@ -20,8 +18,10 @@
* File System (HDFS).
*/
+#ifdef H5_HAVE_LIBHDFS
/* This source code file is part of the H5FD driver module */
#include "H5FDdrvr_module.h"
+#endif
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
diff --git a/src/H5FDhdfs.h b/src/H5FDhdfs.h
index 8d65ac7..7c871a4 100644
--- a/src/H5FDhdfs.h
+++ b/src/H5FDhdfs.h
@@ -1,15 +1,14 @@
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * Read-Only HDFS Virtual File Driver (VFD) *
- * Copyright (c) 2018, The HDF Group. *
+ * Copyright by The HDF Group. *
* *
* All rights reserved. *
* *
- * NOTICE: *
- * All information contained herein is, and remains, the property of The HDF *
- * Group. The intellectual and technical concepts contained herein are *
- * proprietary to The HDF Group. Dissemination of this information or *
- * reproduction of this material is strictly forbidden unless prior written *
- * permission is obtained from The HDF Group. *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://www.hdfgroup.org/licenses. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
/*
diff --git a/src/H5FDlog.c b/src/H5FDlog.c
index 707c97b..f996b9e 100644
--- a/src/H5FDlog.c
+++ b/src/H5FDlog.c
@@ -1218,7 +1218,6 @@ H5FD__log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pread) */
if (addr != file->pos || OP_READ != file->op) {
-
H5_timer_t seek_timer; /* Timer for seek operation */
H5_timevals_t seek_times; /* Elapsed time for seek operation */
@@ -1441,7 +1440,6 @@ H5FD__log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, ha
#ifndef H5_HAVE_PREADWRITE
/* Seek to the correct location (if we don't have pwrite) */
if (addr != file->pos || OP_WRITE != file->op) {
-
H5_timer_t seek_timer; /* Timer for seek operation */
H5_timevals_t seek_times; /* Elapsed time for seek operation */
diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c
index cf14c90..8cbeff6 100644
--- a/src/H5FDmirror.c
+++ b/src/H5FDmirror.c
@@ -15,12 +15,12 @@
* a remote host.
*/
-#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
-
#include "H5private.h" /* Generic Functions */
#ifdef H5_HAVE_MIRROR_VFD
+#include "H5FDdrvr_module.h" /* This source code file is part of the H5FD driver module */
+
#include "H5Eprivate.h" /* Error handling */
#include "H5Fprivate.h" /* File access */
#include "H5FDprivate.h" /* File drivers */
diff --git a/src/H5FDmulti.c b/src/H5FDmulti.c
index 86f7664..cae4174 100644
--- a/src/H5FDmulti.c
+++ b/src/H5FDmulti.c
@@ -44,7 +44,7 @@
#define my_strdup strdup
#endif
-/* Macros for enabling/disabling particular GCC warnings
+/* Macros for enabling/disabling particular GCC / clang warnings
*
* These are (renamed) duplicates of macros in H5private.h. If you make changes
* here, be sure to update those as well.
@@ -646,7 +646,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
H5Eclear2(H5E_DEFAULT);
/* Name and version number */
- strncpy(name, "NCSAmulti", (size_t)8);
+ strncpy(name, "NCSAmult", (size_t)9);
name[8] = '\0';
assert(7 == H5FD_MEM_NTYPES);
@@ -682,7 +682,7 @@ H5FD_multi_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf /*out
p = buf + 8 + nseen * 2 * 8;
UNIQUE_MEMBERS (file->fa.memb_map, mt) {
size_t n = strlen(file->fa.memb_name[mt]) + 1;
- strncpy((char *)p, file->fa.memb_name[mt], n);
+ strcpy((char *)p, file->fa.memb_name[mt]);
p += n;
for (i = n; i % 8; i++)
*p++ = '\0';
@@ -2019,6 +2019,7 @@ open_members(H5FD_multi_t *file)
return 0;
}
+H5_MULTI_GCC_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5FD_multi_delete
@@ -2029,6 +2030,7 @@ open_members(H5FD_multi_t *file)
*
*-------------------------------------------------------------------------
*/
+H5_MULTI_GCC_DIAG_OFF("format-nonliteral")
static herr_t
H5FD_multi_delete(const char *filename, hid_t fapl_id)
{
diff --git a/src/H5FDprivate.h b/src/H5FDprivate.h
index 0a8850f..7c0dd77 100644
--- a/src/H5FDprivate.h
+++ b/src/H5FDprivate.h
@@ -168,7 +168,7 @@ typedef struct H5FD_vfd_swmr_idx_entry_t {
uint64_t hdf5_page_offset;
uint64_t md_file_page_offset;
uint32_t length;
- uint32_t chksum;
+ uint32_t checksum;
void * entry_ptr;
uint64_t tick_of_last_change;
hbool_t clean;
diff --git a/src/H5FDros3.c b/src/H5FDros3.c
index 6e116ee..c0361f9 100644
--- a/src/H5FDros3.c
+++ b/src/H5FDros3.c
@@ -22,8 +22,10 @@
* Relies on "s3comms" utility layer to implement the AWS REST API.
*/
+#ifdef H5_HAVE_ROS3_VFD
/* This source code file is part of the H5FD driver module */
#include "H5FDdrvr_module.h"
+#endif
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c
index c27cd1b..73c898a 100644
--- a/src/H5FDsplitter.c
+++ b/src/H5FDsplitter.c
@@ -340,10 +340,12 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config)
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate file access property list struct")
info->ignore_wo_errs = vfd_config->ignore_wo_errs;
- HDstrncpy(info->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(info->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX);
- info->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
- info->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
+ HDstrncpy(info->wo_path, vfd_config->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ info->wo_path[H5FD_SPLITTER_PATH_MAX] = '\0';
+ HDstrncpy(info->log_file_path, vfd_config->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
+ info->log_file_path[H5FD_SPLITTER_PATH_MAX] = '\0';
+ info->rw_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
+ info->wo_fapl_id = H5P_FILE_ACCESS_DEFAULT; /* pre-set value */
/* Set non-default channel FAPL IDs in splitter configuration info */
if (H5P_DEFAULT != vfd_config->rw_fapl_id) {
@@ -412,8 +414,8 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/)
if (NULL == (fapl_ptr = (const H5FD_splitter_fapl_t *)H5P_peek_driver_info(plist_ptr)))
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "unable to get specific-driver info")
- HDstrncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
+ HDstrncpy(config->wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ HDstrncpy(config->log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
config->ignore_wo_errs = fapl_ptr->ignore_wo_errs;
/* Copy R/W and W/O FAPLs */
@@ -587,8 +589,8 @@ H5FD__splitter_fapl_copy(const void *_old_fa)
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, NULL, "unable to allocate log file FAPL")
H5MM_memcpy(new_fa_ptr, old_fa_ptr, sizeof(H5FD_splitter_fapl_t));
- HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
+ HDstrncpy(new_fa_ptr->wo_path, old_fa_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ HDstrncpy(new_fa_ptr->log_file_path, old_fa_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
/* Copy R/W and W/O FAPLs */
if (H5FD__copy_plist(old_fa_ptr->rw_fapl_id, &(new_fa_ptr->rw_fapl_id)) < 0)
@@ -688,8 +690,8 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "unable to get VFL driver info")
/* Copy simpler info */
- HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX);
- HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX);
+ HDstrncpy(file_ptr->fa.wo_path, fapl_ptr->wo_path, H5FD_SPLITTER_PATH_MAX + 1);
+ HDstrncpy(file_ptr->fa.log_file_path, fapl_ptr->log_file_path, H5FD_SPLITTER_PATH_MAX + 1);
file_ptr->fa.ignore_wo_errs = fapl_ptr->ignore_wo_errs;
/* Copy R/W and W/O channel FAPLs. */
diff --git a/src/H5FDtest.c b/src/H5FDtest.c
index a55d34c..521886f 100644
--- a/src/H5FDtest.c
+++ b/src/H5FDtest.c
@@ -162,7 +162,7 @@ H5FD__vfd_swmr_reader_md_test(H5FD_t *file, unsigned num_entries, H5FD_vfd_swmr_
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
"incorrect md_file_page_offset read from metadata file")
- if (vfd_index[i].chksum != index[i].chksum)
+ if (vfd_index[i].checksum != index[i].checksum)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect chksum read from metadata file")
}
}
diff --git a/src/H5FDvfd_swmr.c b/src/H5FDvfd_swmr.c
index 568f5d9..73d8df4 100644
--- a/src/H5FDvfd_swmr.c
+++ b/src/H5FDvfd_swmr.c
@@ -857,7 +857,7 @@ H5FD__vfd_swmr_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id
* signature.
*/
if (file->pb_configured && entry->length == init_size &&
- H5_checksum_metadata(buf, entry->length, 0) != entry->chksum) {
+ H5_checksum_metadata(buf, entry->length, 0) != entry->checksum) {
H5FD_vfd_swmr_md_header tmp_header;
if (H5FD__vfd_swmr_header_deserialize(file, &tmp_header) != TRUE)
@@ -1331,7 +1331,7 @@ H5FD__vfd_swmr_index_deserialize(const H5FD_vfd_swmr_t *file, H5FD_vfd_swmr_md_i
UINT32DECODE(p, md_index->entries[i].hdf5_page_offset);
UINT32DECODE(p, md_index->entries[i].md_file_page_offset);
UINT32DECODE(p, md_index->entries[i].length);
- UINT32DECODE(p, md_index->entries[i].chksum);
+ UINT32DECODE(p, md_index->entries[i].checksum);
}
}
else
diff --git a/src/H5FL.c b/src/H5FL.c
index fbeb9d2..cb58868 100644
--- a/src/H5FL.c
+++ b/src/H5FL.c
@@ -337,8 +337,11 @@ H5FL_reg_free(H5FL_reg_head_t *head, void *obj)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -443,8 +446,11 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -908,8 +914,11 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
@@ -1004,8 +1013,11 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -1120,14 +1132,20 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_
/* Release previous tracking information */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Store new tracking information */
trk->stack = H5CS_copy_stack();
HDassert(trk->stack);
- trk->file = H5MM_strdup(call_file);
- trk->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ trk->file = call_file;
+ trk->func = call_func;
trk->line = call_line;
}
#endif /* H5FL_TRACK */
@@ -2017,8 +2035,11 @@ H5FL_fac_free(H5FL_fac_head_t *head, void *obj)
/* Free tracking information about the allocation location */
H5CS_close_stack(trk->stack);
- trk->file = H5MM_xfree(trk->file);
- trk->func = H5MM_xfree(trk->func);
+ /* The 'func' & 'file' strings are statically allocated (by the compiler)
+ * and are not allocated, so there's no need to free them.
+ */
+ trk->file = NULL;
+ trk->func = NULL;
/* Remove from "outstanding allocations" list */
if (trk == H5FL_out_head_g) {
@@ -2120,8 +2141,11 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS)
/* Copy allocation location information */
((H5FL_track_t *)ret_value)->stack = H5CS_copy_stack();
HDassert(((H5FL_track_t *)ret_value)->stack);
- ((H5FL_track_t *)ret_value)->file = H5MM_strdup(call_file);
- ((H5FL_track_t *)ret_value)->func = H5MM_strdup(call_func);
+ /* The 'call_func' & 'call_file' strings are statically allocated (by the compiler)
+ * there's no need to duplicate them.
+ */
+ ((H5FL_track_t *)ret_value)->file = call_file;
+ ((H5FL_track_t *)ret_value)->func = call_func;
((H5FL_track_t *)ret_value)->line = call_line;
/* Add to "outstanding allocations" list */
diff --git a/src/H5Faccum.c b/src/H5Faccum.c
index aed5812..4821272 100644
--- a/src/H5Faccum.c
+++ b/src/H5Faccum.c
@@ -36,7 +36,7 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
+#include "H5FDprivate.h" /* File drivers */
#include "H5MMprivate.h" /* Memory management */
#include "H5VMprivate.h" /* Vectors and arrays */
diff --git a/src/H5Fdeprec.c b/src/H5Fdeprec.c
index b482961..ff6b4a0 100644
--- a/src/H5Fdeprec.c
+++ b/src/H5Fdeprec.c
@@ -89,10 +89,12 @@
herr_t
H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- H5I_type_t type;
- H5F_info2_t finfo2; /* Current file info struct */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ H5I_type_t type;
+ H5F_info2_t finfo2; /* Current file info struct */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ix", obj_id, finfo);
@@ -111,9 +113,14 @@ H5Fget_info1(hid_t obj_id, H5F_info1_t *finfo /*out*/)
if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ file_opt_args.get_info.type = type;
+ file_opt_args.get_info.finfo = &finfo2;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_INFO;
+ vol_cb_args.args = &file_opt_args;
+
/* Get the file information */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- type, &finfo2) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to retrieve file info")
/* Copy the compatible fields into the older struct */
@@ -141,7 +148,9 @@ done:
htri_t
H5Fis_hdf5(const char *name)
{
- htri_t ret_value; /* Return value */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ htri_t ret_value; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE1("t", "*s", name);
@@ -150,11 +159,19 @@ H5Fis_hdf5(const char *name)
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADRANGE, (-1), "no file name specified")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = name;
+ vol_cb_args.args.is_accessible.fapl_id = H5P_FILE_ACCESS_DEFAULT;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
/* Check if file is accessible */
- if (H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- H5P_FILE_ACCESS_DEFAULT, name, &ret_value) < 0)
+ if (H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_NOTHDF5, (-1), "unable to determine if file is accessible as HDF5")
+ /* Set return value */
+ ret_value = (htri_t)is_accessible;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Fis_hdf5() */
@@ -196,10 +213,11 @@ done:
herr_t
H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
{
- H5VL_object_t *vol_obj; /* File as VOL object */
- H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
- H5F_libver_t high = H5F_LIBVER_LATEST; /* High bound */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* File as VOL object */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ H5F_libver_t low = H5F_LIBVER_LATEST; /* Low bound */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE2("e", "ib", file_id, latest_format);
@@ -218,9 +236,14 @@ H5Fset_latest_format(hid_t file_id, hbool_t latest_format)
if (!latest_format)
low = H5F_LIBVER_EARLIEST;
+ /* Set up VOL callback arguments */
+ file_opt_args.set_libver_bounds.low = low;
+ file_opt_args.set_libver_bounds.high = H5F_LIBVER_LATEST;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS;
+ vol_cb_args.args = &file_opt_args;
+
/* Set the library's version bounds */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)low, (int)high) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set library version bounds")
done:
diff --git a/src/H5Fefc.c b/src/H5Fefc.c
index 3f9a22f..2d4eff2 100644
--- a/src/H5Fefc.c
+++ b/src/H5Fefc.c
@@ -36,10 +36,10 @@
#include "H5Pprivate.h" /* Property lists */
/* Special values for the "tag" field below */
-#define H5F_EFC_TAG_DEFAULT -1
-#define H5F_EFC_TAG_LOCK -2
-#define H5F_EFC_TAG_CLOSE -3
-#define H5F_EFC_TAG_DONTCLOSE -4
+#define H5F_EFC_TAG_DEFAULT (-1)
+#define H5F_EFC_TAG_LOCK (-2)
+#define H5F_EFC_TAG_CLOSE (-3)
+#define H5F_EFC_TAG_DONTCLOSE (-4)
/* Structure for each entry in a file's external file cache */
typedef struct H5F_efc_ent_t {
diff --git a/src/H5Fint.c b/src/H5Fint.c
index 247a047..b80fd15 100644
--- a/src/H5Fint.c
+++ b/src/H5Fint.c
@@ -82,6 +82,7 @@ static herr_t H5F__build_name(const char *prefix, const char *file_name, char **
static char * H5F__getenv_prefix_name(char **env_prefix /*in,out*/);
static H5F_t *H5F__new(H5F_shared_t *shared, unsigned flags, hid_t fcpl_id, hid_t fapl_id, H5FD_t *lf);
static herr_t H5F__check_if_using_file_locks(H5P_genplist_t *fapl, hbool_t *use_file_locking);
+static herr_t H5F__dest(H5F_t *f, hbool_t flush);
static herr_t H5F__build_actual_name(const H5F_t *f, const H5P_genplist_t *fapl, const char *name,
char ** /*out*/ actual_name);
static herr_t H5F__flush_phase1(H5F_t *f);
@@ -1403,12 +1404,12 @@ done:
* Return: SUCCEED/FAIL
*-------------------------------------------------------------------------
*/
-herr_t
+static herr_t
H5F__dest(H5F_t *f, hbool_t flush)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_STATIC
/* Sanity check */
HDassert(f);
@@ -1834,25 +1835,28 @@ done:
H5F_t *
H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
{
- H5F_t * file = NULL; /*the success return value */
- H5F_shared_t * shared = NULL; /*shared part of `file' */
- H5FD_t * lf = NULL; /*file driver part of `shared' */
- unsigned tent_flags; /*tentative flags */
- H5FD_class_t * drvr; /*file driver class info */
- H5P_genplist_t * a_plist; /*file access property list */
- H5F_close_degree_t fc_degree; /*file close degree */
- size_t page_buf_size;
- unsigned page_buf_min_meta_perc = 0;
- unsigned page_buf_min_raw_perc = 0;
- hbool_t set_flag = FALSE; /* Set the status_flags in the superblock */
- hbool_t clear = FALSE; /* Clear the status_flags */
- hbool_t evict_on_close; /* Evict on close value from plist */
- hbool_t use_file_locking = TRUE; /* Using file locks? */
- hbool_t ci_load = FALSE; /* Whether MDC ci load requested */
- hbool_t ci_write = FALSE; /* Whether MDC CI write requested */
- hbool_t file_create = FALSE; /* Creating a new file or not */
- H5F_vfd_swmr_config_t *vfd_swmr_config_ptr = NULL; /* Points to VFD SMWR config info */
- H5F_t * ret_value = NULL; /* Actual return value */
+ H5F_t * file = NULL; /*the success return value */
+ H5F_shared_t * shared = NULL; /*shared part of `file' */
+ H5FD_t * lf = NULL; /*file driver part of `shared' */
+ unsigned tent_flags; /*tentative flags */
+ H5FD_class_t * drvr; /*file driver class info */
+ H5P_genplist_t * a_plist; /*file access property list */
+ H5F_close_degree_t fc_degree; /*file close degree */
+ size_t page_buf_size;
+ unsigned page_buf_min_meta_perc = 0;
+ unsigned page_buf_min_raw_perc = 0;
+ hbool_t set_flag = FALSE; /* Set the status_flags in the superblock */
+ hbool_t clear = FALSE; /* Clear the status_flags */
+ hbool_t evict_on_close; /* Evict on close value from plist */
+ hbool_t use_file_locking = TRUE; /* Using file locks? */
+ hbool_t ci_load = FALSE; /* Whether MDC ci load requested */
+ hbool_t ci_write = FALSE; /* Whether MDC ci write requested */
+ hbool_t file_create = FALSE; /* Creating a new file or not */
+ H5F_vfd_swmr_config_t * vfd_swmr_config_ptr = NULL; /* Points to VFD SMWR config info */
+ H5F_generate_md_ck_cb_t cb_info = {NULL}; /* For VFD SWMR NFS testing:
+ initialize the callback to generate
+ checksums for metadata files */
+ H5F_t *ret_value = NULL; /* Actual return value */
FUNC_ENTER_NOAPI(NULL)
@@ -1875,6 +1879,10 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "file access is writer but VFD SWMR config is reader")
if ((flags & H5F_ACC_RDWR) == 0 && vfd_swmr_config_ptr->writer)
HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "file access is reader but VFD SWMR config is writer")
+
+ /* Retrieve the private property for VFD SWMR testing */
+ if (H5P_get(a_plist, H5F_ACS_GENERATE_MD_CK_CB_NAME, &cb_info) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, NULL, "can't get generate_md_ck_cb info")
}
/*
@@ -2012,7 +2020,8 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Short cuts */
shared = file->shared;
- lf = shared->lf;
+
+ lf = shared->lf;
/* Set the file locking flag. If the file is already open, the file
* requested file locking flag must match that of the open file.
@@ -2091,8 +2100,27 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Checked if configured for VFD SWMR */
if (H5F_VFD_SWMR_CONFIG(file)) {
+
+ /* Set up the VFD SWMR LOG file */
+ /* Kent*/
+ if (HDstrlen(vfd_swmr_config_ptr->log_file_path) > 0)
+ shared->vfd_swmr_log_on = TRUE;
+ if (TRUE == shared->vfd_swmr_log_on) {
+ /* Create the log file */
+ if ((shared->vfd_swmr_log_file_ptr = HDfopen(vfd_swmr_config_ptr->log_file_path, "w")) == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, NULL, "unable to create the log file")
+ if (H5_timer_init(&(shared->vfd_swmr_log_start_time)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't initialize HDF5 timer.")
+ if (H5_timer_start(&(shared->vfd_swmr_log_start_time)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "can't obtain the time from the HDF5 timer.")
+ }
+ /* End of Kent */
+
/* Initialization for VFD SWMR writer and reader */
if (1 == shared->nrefs) {
+ /* Private property for VFD SWMR testing: generate checksum for metadata file */
+ if (cb_info.func)
+ shared->generate_md_ck_cb = cb_info.func;
if (H5F_vfd_swmr_init(file, file_create) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, NULL, "file open fail with initialization for VFD SWMR")
}
@@ -2209,6 +2237,9 @@ H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id)
/* Success */
ret_value = file;
+#if 1 /*Kent: write to the log file when H5F_open ends. Tested, can be commented out if necessary.*/
+ H5F_POST_VFD_SWMR_LOG_ENTRY(file, FILE_OPEN, "File open ends");
+#endif
done:
if ((NULL == ret_value) && file) {
if (file->shared->root_grp && file->shared->nrefs == 1) {
@@ -2487,11 +2518,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_delete(const char *filename, hid_t fapl_id)
+H5F__delete(const char *filename, hid_t fapl_id)
{
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_PACKAGE
HDassert(filename);
@@ -2501,7 +2532,7 @@ H5F_delete(const char *filename, hid_t fapl_id)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F_delete() */
+} /* end H5F__delete() */
/*-------------------------------------------------------------------------
* Function: H5F_try_close
@@ -3241,27 +3272,28 @@ done:
/*-------------------------------------------------------------------------
* Function: H5F__get_file_image
*
- * Purpose: Private version of H5Fget_file_image
+ * Purpose: Private version of H5Fget_file_image, returns bytes copied/
+ * number of bytes needed in *image_len.
+ *
+ * Return: SUCCEED/FAIL
*
- * Return: Success: Bytes copied / number of bytes needed.
- * Failure: -1
*-------------------------------------------------------------------------
*/
-ssize_t
-H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
+herr_t
+H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len, size_t *image_len)
{
- H5FD_t *fd_ptr; /* file driver */
- haddr_t eoa; /* End of file address */
- ssize_t ret_value = -1; /* Return value */
+ H5FD_t *fd_ptr; /* file driver */
+ haddr_t eoa; /* End of file address */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check args */
if (!file || !file->shared || !file->shared->lf)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "file_id yields invalid file pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "file_id yields invalid file pointer")
fd_ptr = file->shared->lf;
if (!fd_ptr->cls)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "fd_ptr yields invalid class pointer")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "fd_ptr yields invalid class pointer")
/* the address space used by the split and multi file drivers is not
* a good fit for this call. Since the plan is to depreciate these
@@ -3282,7 +3314,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* JRM -- 11/11/22
*/
if (HDstrcmp(fd_ptr->cls->name, "multi") == 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, (-1), "Not supported for multi file driver.")
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Not supported for multi file driver.")
/* While the family file driver is conceptually fully compatible
* with the get file image operation, it sets a file driver message
@@ -3290,7 +3322,7 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* driver other than the family file driver. Needless to say, this
* rather defeats the purpose of the get file image operation.
*
- * While this problem is quire solvable, the required time and
+ * While this problem is quite solvable, the required time and
* resources are lacking at present. Hence, for now, we don't
* allow the get file image operation to be perfomed on files
* opened with the family file driver.
@@ -3304,30 +3336,24 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
* JRM -- 12/21/11
*/
if (HDstrcmp(fd_ptr->cls->name, "family") == 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "Not supported for family file driver.")
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "Not supported for family file driver.")
/* Go get the actual file size */
if (HADDR_UNDEF == (eoa = H5FD_get_eoa(file->shared->lf, H5FD_MEM_DEFAULT)))
- HGOTO_ERROR(H5E_FILE, H5E_CANTGET, (-1), "unable to get file size")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get file size")
- /* set ret_value = to eoa -- will overwrite this if appropriate */
- ret_value = (ssize_t)eoa;
-
- /* test to see if a buffer was provided -- if not, we are done */
+ /* Test to see if a buffer was provided */
if (buf_ptr != NULL) {
- size_t space_needed; /* size of file image */
unsigned tmp, tmp_size;
/* Check for buffer too small */
if ((haddr_t)buf_len < eoa)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, (-1), "supplied buffer too small")
-
- space_needed = (size_t)eoa;
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "supplied buffer too small")
- /* read in the file image */
+ /* Read in the file image */
/* (Note compensation for base address addition in internal routine) */
- if (H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, space_needed, buf_ptr) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, (-1), "file image read request failed")
+ if (H5FD_read(fd_ptr, H5FD_MEM_DEFAULT, 0, (size_t)eoa, buf_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "file image read request failed")
/* Offset to "status_flags" in the superblock */
tmp = H5F_SUPER_STATUS_FLAGS_OFF(file->shared->sblock->super_vers);
@@ -3339,6 +3365,9 @@ H5F__get_file_image(H5F_t *file, void *buf_ptr, size_t buf_len)
HDmemset((uint8_t *)buf_ptr + tmp, 0, tmp_size);
} /* end if */
+ /* Set *image_len = to EOA */
+ *image_len = (size_t)eoa;
+
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__get_file_image() */
@@ -3745,7 +3774,7 @@ herr_t
H5F__start_swmr_write(H5F_t *f)
{
hbool_t ci_load = FALSE; /* whether MDC ci load requested */
- hbool_t ci_write = FALSE; /* whether MDC CI write requested */
+ hbool_t ci_write = FALSE; /* whether MDC ci write requested */
size_t grp_dset_count = 0; /* # of open objects: groups & datasets */
size_t nt_attr_count = 0; /* # of opened named datatypes + opened attributes */
hid_t * obj_ids = NULL; /* List of ids */
@@ -4043,11 +4072,12 @@ done:
hid_t
H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
{
- void * vol_obj_file = NULL; /* File object pointer */
- H5VL_loc_params_t loc_params; /* Location parameters */
- hid_t file_id = H5I_INVALID_HID; /* File ID for object */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * vol_obj_file = NULL; /* File object pointer */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for object */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_NOAPI(H5I_INVALID_HID)
@@ -4055,9 +4085,12 @@ H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_FILE;
+ vol_cb_args.args.get_file.file = &vol_obj_file;
+
/* Retrieve VOL file from object */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_FILE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &vol_obj_file) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, H5I_INVALID_HID, "can't retrieve file from object")
/* Check if the file's ID already exists */
diff --git a/src/H5Fmodule.h b/src/H5Fmodule.h
index 7f0299a..81c1ede 100644
--- a/src/H5Fmodule.h
+++ b/src/H5Fmodule.h
@@ -29,8 +29,7 @@
#define H5_MY_PKG_ERR H5E_FILE
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5F H5F
+/**\defgroup H5F H5F
*
* Use the functions in this module to manage HDF5 files.
*
@@ -41,15 +40,23 @@
* creation or access \c mode control the interaction with the underlying
* storage such as file systems.
*
- * \Emph{Proper error handling is part of the life cycle.}
* <table>
- * <tr><th>Create</th><th>Open</th></tr>
+ * <tr><th>Create</th><th>Read</th></tr>
* <tr valign="top">
* <td>
- * \snippet H5F_examples.c life_cycle
+ * \snippet{lineno} H5F_examples.c create
* </td>
* <td>
- * \snippet H5F_examples.c life_cycle_w_open
+ * \snippet{lineno} H5F_examples.c read
+ * </td>
+ * </tr>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5F_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5F_examples.c delete
* </td>
* </tr>
* </table>
diff --git a/src/H5Fmount.c b/src/H5Fmount.c
index f107c98..4b90ea3 100644
--- a/src/H5Fmount.c
+++ b/src/H5Fmount.c
@@ -83,7 +83,7 @@ done:
} /* end H5F__close_mounts() */
/*-------------------------------------------------------------------------
- * Function: H5F__mount
+ * Function: H5F_mount
*
* Purpose: Mount file CHILD onto the group specified by LOC and NAME,
* using mount properties in PLIST. CHILD must not already be
@@ -97,7 +97,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED plist_id)
+H5F_mount(const H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED plist_id)
{
H5G_t * mount_point = NULL; /*mount point group */
H5F_t * ancestor = NULL; /*ancestor files */
@@ -110,7 +110,7 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
H5G_loc_t root_loc; /* Group location of root of file to mount */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(loc);
HDassert(name && *name);
@@ -157,10 +157,9 @@ H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t H5_ATTR_UNUSED
HDassert(mp_loc.oloc);
mp_loc.path = H5G_nameof(mount_point);
HDassert(mp_loc.path);
- for (ancestor = parent; ancestor; ancestor = ancestor->parent) {
+ for (ancestor = parent; ancestor; ancestor = ancestor->parent)
if (ancestor->shared == child->shared)
HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "mount would introduce a cycle")
- }
/* Make certain that the parent & child files have the same "file close degree" */
if (parent->shared->fc_degree != child->shared->fc_degree)
@@ -240,10 +239,10 @@ done:
}
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__mount() */
+} /* end H5F_mount() */
/*-------------------------------------------------------------------------
- * Function: H5F__unmount
+ * Function: H5F_unmount
*
* Purpose: Unmount the child which is mounted at the group specified by
* LOC and NAME or fail if nothing is mounted there. Neither
@@ -261,7 +260,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F__unmount(H5G_loc_t *loc, const char *name)
+H5F_unmount(const H5G_loc_t *loc, const char *name)
{
H5G_t * child_group = NULL; /* Child's group in parent mtab */
H5F_t * child = NULL; /*mounted file */
@@ -275,7 +274,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
int child_idx; /* Index of child in parent's mtab */
herr_t ret_value = SUCCEED; /*return value */
- FUNC_ENTER_PACKAGE
+ FUNC_ENTER_NOAPI(FAIL)
HDassert(loc);
HDassert(name && *name);
@@ -291,7 +290,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
* then we must have found the mount point.
*/
if (H5G_loc_find(loc, name, &mp_loc /*out*/) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "group not found")
+ HGOTO_ERROR(H5E_FILE, H5E_NOTFOUND, FAIL, "group not found")
mp_loc_setup = TRUE;
child = mp_loc.oloc->file;
mnt_oloc = H5G_oloc(child->shared->root_grp);
@@ -364,7 +363,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
/* Search the open IDs replace names to reflect unmount operation */
if (H5G_name_replace(NULL, H5G_NAME_UNMOUNT, mp_loc.oloc->file, mp_loc.path->full_path_r,
root_loc.oloc->file, root_loc.path->full_path_r) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTINIT, FAIL, "unable to replace name")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to replace name")
/* Eliminate the mount point from the table */
HDmemmove(parent->shared->mtab.child + (unsigned)child_idx,
@@ -376,7 +375,7 @@ H5F__unmount(H5G_loc_t *loc, const char *name)
/* Unmount the child file from the parent file */
if (H5G_unmount(child_group) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to reset group mounted flag")
+ HGOTO_ERROR(H5E_FILE, H5E_CANTRELEASE, FAIL, "unable to reset group mounted flag")
if (H5G_close(child_group) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEOBJ, FAIL, "unable to close unmounted group")
@@ -391,7 +390,7 @@ done:
H5G_loc_free(&mp_loc);
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5F__unmount() */
+} /* end H5F_unmount() */
/*-------------------------------------------------------------------------
* Function: H5F_is_mount
diff --git a/src/H5Fmpi.c b/src/H5Fmpi.c
index 4b5283e..53d2d78 100644
--- a/src/H5Fmpi.c
+++ b/src/H5Fmpi.c
@@ -193,7 +193,7 @@ done:
} /* end H5F_mpi_get_size() */
/*-------------------------------------------------------------------------
- * Function: H5F_set_mpi_atomicity
+ * Function: H5F__set_mpi_atomicity
*
* Purpose: Private call to set the atomicity mode
*
@@ -202,11 +202,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag)
+H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(file);
@@ -222,7 +222,7 @@ H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5F_set_mpi_atomicity() */
+} /* end H5F__set_mpi_atomicity() */
/*-------------------------------------------------------------------------
* Function: H5Fset_mpi_atomicity
@@ -240,9 +240,10 @@ done:
herr_t
H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
{
- H5VL_object_t *vol_obj = NULL;
- int va_flag = (int)flag; /* C is grumpy about passing hbool_t via va_arg */
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE2("e", "ib", file_id, flag);
@@ -251,9 +252,13 @@ H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier");
+ /* Set up VOL callback arguments */
+ file_opt_args.set_mpi_atomicity.flag = flag;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_SET_MPI_ATOMICITY;
+ vol_cb_args.args = &file_opt_args;
+
/* Set atomicity value */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_SET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, va_flag) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to set MPI atomicity");
done:
@@ -261,7 +266,7 @@ done:
} /* end H5Fset_mpi_atomicity() */
/*-------------------------------------------------------------------------
- * Function: H5F_get_mpi_atomicity
+ * Function: H5F__get_mpi_atomicity
*
* Purpose: Private call to get the atomicity mode
*
@@ -270,11 +275,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag)
+H5F__get_mpi_atomicity(const H5F_t *file, hbool_t *flag)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
/* Check args */
HDassert(file);
@@ -291,7 +296,7 @@ H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag)
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* end H5F_get_mpi_atomicity() */
+} /* end H5F__get_mpi_atomicity() */
/*-------------------------------------------------------------------------
* Function: H5Fget_mpi_atomicity
@@ -309,8 +314,10 @@ done:
herr_t
H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* File info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_file_optional_args_t file_opt_args; /* Arguments for optional operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE2("e", "ix", file_id, flag);
@@ -319,9 +326,13 @@ H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag /*out*/)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(file_id, H5I_FILE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid file identifier");
+ /* Set up VOL callback arguments */
+ file_opt_args.get_mpi_atomicity.flag = flag;
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_GET_MPI_ATOMICITY;
+ vol_cb_args.args = &file_opt_args;
+
/* Get atomicity value */
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_GET_MPI_ATOMICITY, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, flag) < 0)
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "unable to get MPI atomicity");
done:
diff --git a/src/H5Fpkg.h b/src/H5Fpkg.h
index 71c27f2..ca26941 100644
--- a/src/H5Fpkg.h
+++ b/src/H5Fpkg.h
@@ -455,20 +455,53 @@ struct H5F_shared_t {
uint32_t old_mdf_idx_len;
uint32_t old_mdf_idx_entries_used;
- /* Metadata file for VFD SWMR writer */
- int vfd_swmr_md_fd; /* POSIX: file descriptor for the
- * metadata file
- */
- haddr_t vfd_swmr_md_eoa; /* POSIX: eoa for the metadata
- * file
- */
+ /* Metadata file and updater file for VFD SWMR writer */
+ int vfd_swmr_md_fd; /* POSIX: file descriptor for the
+ * metadata file or -1 if the metadata file
+ * is not currently open.
+ * The vfd_swmr_config.generate_updater_files
+ * is FALSE.
+ */
+ /* NFS:
+ * The vfd_swmr_config.generate_updater_files
+ * is TRUE and:
+ * --if vfd_swmr_config.writer is FALSE,
+ * this field is the file descriptor of the local
+ * copy of the metadata file, or -1 if the local
+ * copy is not currently open.
+ * --if vfd_swmr_config.writer is TRUE, this field
+ * is not used and is set to -1.
+ */
+ H5F_generate_md_ck_t generate_md_ck_cb;
+ /* For testing only:
+ * Invoke the user-defined callback if exists to
+ * generate checksum for the metadata file
+ */
+
+ haddr_t vfd_swmr_md_eoa; /* POSIX: eoa for the metadata
+ * file
+ */
+ uint64_t updater_seq_num; /* Sequence number of the next updater file to be
+ * genereated. This field must be initialized to zero,
+ * and incremented after each updater file is generated.
+ */
/* Free space manager for the metadata file */
H5FS_t * fs_man_md; /* Free-space manager */
H5F_fs_state_t fs_state_md; /* State of the free space
* manager
*/
-
+ /* Log file for VFD SWMR */
+ FILE *vfd_swmr_log_file_ptr; /* File pointer for the
+ * log file.
+ */
+ hbool_t vfd_swmr_log_on; /* flag to indicate if
+ * the log file is
+ * created. */
+ H5_timer_t vfd_swmr_log_start_time; /* The starting time for
+ * calculating the time
+ * stamp of a log message.
+ */
/* Delayed free space release doubly linked list */
shadow_defree_queue_t shadow_defrees;
@@ -519,25 +552,23 @@ H5_DLLVAR htri_t use_locks_env_g;
/* General routines */
H5_DLL herr_t H5F__post_open(H5F_t *f);
-H5_DLL H5F_t * H5F__reopen(H5F_t *f);
-H5_DLL herr_t H5F__dest(H5F_t *f, hbool_t flush);
-H5_DLL herr_t H5F__flush(H5F_t *f);
-H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id);
-H5_DLL ssize_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len);
-H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo);
-H5_DLL herr_t H5F__format_convert(H5F_t *f);
-H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
-H5_DLL herr_t H5F__close(H5F_t *f);
-H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
-H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info);
-H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks);
-H5_DLL herr_t H5F__vfd_swmr_end_tick(H5F_t *f);
-H5_DLL herr_t H5F__vfd_swmr_disable_end_of_tick(H5F_t *f);
-H5_DLL herr_t H5F__vfd_swmr_enable_end_of_tick(H5F_t *f);
+H5_DLL H5F_t *H5F__reopen(H5F_t *f);
+H5_DLL herr_t H5F__flush(H5F_t *f);
+H5_DLL htri_t H5F__is_hdf5(const char *name, hid_t fapl_id);
+H5_DLL herr_t H5F__get_file_image(H5F_t *f, void *buf_ptr, size_t buf_len, size_t *image_len);
+H5_DLL herr_t H5F__get_info(H5F_t *f, H5F_info2_t *finfo);
+H5_DLL herr_t H5F__format_convert(H5F_t *f);
+H5_DLL herr_t H5F__start_swmr_write(H5F_t *f);
+H5_DLL herr_t H5F__close(H5F_t *f);
+H5_DLL herr_t H5F__set_libver_bounds(H5F_t *f, H5F_libver_t low, H5F_libver_t high);
+H5_DLL herr_t H5F__get_cont_info(const H5F_t *f, H5VL_file_cont_info_t *info);
+H5_DLL herr_t H5F__parse_file_lock_env_var(htri_t *use_locks);
+H5_DLL herr_t H5F__delete(const char *filename, hid_t fapl_id);
+H5_DLL herr_t H5F__vfd_swmr_end_tick(H5F_t *f);
+H5_DLL herr_t H5F__vfd_swmr_disable_end_of_tick(H5F_t *f);
+H5_DLL herr_t H5F__vfd_swmr_enable_end_of_tick(H5F_t *f);
/* File mount related routines */
-H5_DLL herr_t H5F__mount(H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
-H5_DLL herr_t H5F__unmount(H5G_loc_t *loc, const char *name);
H5_DLL herr_t H5F__close_mounts(H5F_t *f);
H5_DLL herr_t H5F__mount_count_ids(H5F_t *f, unsigned *nopen_files, unsigned *nopen_objs);
@@ -567,6 +598,12 @@ H5_DLL herr_t H5F__sfile_add(H5F_shared_t *shared);
H5_DLL H5F_shared_t *H5F__sfile_search(H5FD_t *lf);
H5_DLL herr_t H5F__sfile_remove(H5F_shared_t *shared);
+/* Parallel I/O (i.e. MPI) related routines */
+#ifdef H5_HAVE_PARALLEL
+H5_DLL herr_t H5F__get_mpi_atomicity(const H5F_t *file, hbool_t *flag);
+H5_DLL herr_t H5F__set_mpi_atomicity(H5F_t *file, hbool_t flag);
+#endif /* H5_HAVE_PARALLEL */
+
/* External file cache routines */
H5_DLL H5F_efc_t *H5F__efc_create(unsigned max_nfiles);
H5_DLL H5F_t * H5F__efc_open(H5F_t *parent, const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
@@ -604,4 +641,61 @@ H5_DLL htri_t H5F__same_file_test(hid_t file_id1, hid_t file_id2);
H5_DLL herr_t H5F__reparse_file_lock_variable_test(void);
#endif /* H5F_TESTING */
+/* VFD SMWR LOG REPORTING MACROS */
+
+/* H5F_POST_VFD_SWMR_LOG_ENTRY is the macro that can help the developers debug VFD SWMR features.
+ * It calls an internal reporting function H5F_post_vfd_swmr_log_entry() that receives
+ * a log entry_type_code, which generates a log tag, and the message log_info, which
+ * the developers want to save into a log file.
+ *
+ * The macro H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, number_entry_production, m) is
+ * called by H5F_POST_VFD_SWMR_LOG_ENTRY when the HDF5 library is built with the
+ * production mode. Number_entry_production will control the number of entry tags that
+ * applications can receive. Currently this number is set to 1 and is subject to change
+ * when more tags are useful to be present to applications.
+ *
+ * The first argument of the macro is the HDF5 file pointer(H5F_t *).
+ * Its value needs to be checked to avoid a failure caused by "Low-Level File I/O "
+ * in the testhdf5 program, which involves the test of a non-existing HDF5 file.
+ */
+
+H5_DLL void H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *log_info);
+
+#define H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info) \
+ do { \
+ if (fp != NULL) { \
+ if (fp->shared != NULL) { \
+ if (fp->shared->vfd_swmr_log_on == TRUE) { \
+ H5F_post_vfd_swmr_log_entry(fp, entry_type_code, log_info); \
+ } \
+ } \
+ } \
+ } while (0)
+
+#define H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(fp, entry_type_code, max_code, log_info) \
+ do { \
+ if (entry_type_code < max_code) { \
+ H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(fp, entry_type_code, log_info); \
+ } \
+ } while (0)
+
+/* Note: change H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m) on the following lines to
+ * H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, your_number_entry_production, m)
+ * as necessary.
+ */
+#ifndef NDEBUG
+#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_INTERNAL(f, c, m)
+#else
+#define H5F_POST_VFD_SWMR_LOG_ENTRY(f, c, m) H5F_POST_VFD_SWMR_LOG_ENTRY_PRODUCTION(f, c, 1, m)
+#endif
+
+/* Macros for VFD SWMR log entry code
+ * Note: this should be consistent with const char *H5Fvfd_swmr_log_tags[] declared at
+ * H5Fvfd_swmr.c .
+ */
+#define EOT_PROCESSING_TIME 0
+#define FILE_OPEN 1
+#define FILE_CLOSE 2
+#define EOT_TRIGGER_TIME 3
+#define EOT_META_FILE_INDEX 4
#endif /* H5Fpkg_H */
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 901ab7c..9a4f363 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -301,23 +301,36 @@ uint64_decode(uint8_t **pp)
(p) += 8; \
}
+/* clang-format off */
/* Address-related macros */
-#define H5F_addr_overflow(X, Z) \
- (HADDR_UNDEF == (X) || HADDR_UNDEF == (X) + (haddr_t)(Z) || (X) + (haddr_t)(Z) < (X))
-#define H5F_addr_defined(X) ((X) != HADDR_UNDEF)
+#define H5F_addr_overflow(X,Z) (HADDR_UNDEF==(X) || \
+ HADDR_UNDEF==(X)+(haddr_t)(Z) || \
+ (X)+(haddr_t)(Z)<(X))
+#define H5F_addr_defined(X) ((X)!=HADDR_UNDEF)
/* The H5F_addr_eq() macro guarantees that Y is not HADDR_UNDEF by making
* certain that X is not HADDR_UNDEF and then checking that X equals Y
*/
-#define H5F_addr_eq(X, Y) ((X) != HADDR_UNDEF && (X) == (Y))
-#define H5F_addr_ne(X, Y) (!H5F_addr_eq((X), (Y)))
-#define H5F_addr_lt(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) < (Y))
-#define H5F_addr_le(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) <= (Y))
-#define H5F_addr_gt(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) > (Y))
-#define H5F_addr_ge(X, Y) ((X) != HADDR_UNDEF && (Y) != HADDR_UNDEF && (X) >= (Y))
-#define H5F_addr_cmp(X, Y) (H5F_addr_eq((X), (Y)) ? 0 : (H5F_addr_lt((X), (Y)) ? -1 : 1))
-#define H5F_addr_pow2(N) ((haddr_t)1 << (N))
-#define H5F_addr_overlap(O1, L1, O2, L2) \
- (((O1) < (O2) && ((O1) + (L1)) > (O2)) || ((O1) >= (O2) && (O1) < ((O2) + (L2))))
+#define H5F_addr_eq(X,Y) ((X)!=HADDR_UNDEF && \
+ (X)==(Y))
+#define H5F_addr_ne(X,Y) (!H5F_addr_eq((X),(Y)))
+#define H5F_addr_lt(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)<(Y))
+#define H5F_addr_le(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)<=(Y))
+#define H5F_addr_gt(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)>(Y))
+#define H5F_addr_ge(X,Y) ((X)!=HADDR_UNDEF && \
+ (Y)!=HADDR_UNDEF && \
+ (X)>=(Y))
+#define H5F_addr_cmp(X,Y) (H5F_addr_eq((X), (Y)) ? 0 : \
+ (H5F_addr_lt((X), (Y)) ? -1 : 1))
+#define H5F_addr_pow2(N) ((haddr_t)1<<(N))
+#define H5F_addr_overlap(O1,L1,O2,L2) (((O1) < (O2) && ((O1) + (L1)) > (O2)) || \
+ ((O1) >= (O2) && (O1) < ((O2) + (L2))))
+/* clang-format on */
/* If the module using this macro is allowed access to the private variables, access them directly */
#ifdef H5F_MODULE
@@ -540,18 +553,18 @@ uint64_decode(uint8_t **pp)
#define H5F_DEFAULT_CSET H5T_CSET_ASCII
/* ========= File Creation properties ============ */
-#define H5F_CRT_USER_BLOCK_NAME "block_size" /* Size of the file user block in bytes */
-#define H5F_CRT_SYM_LEAF_NAME "symbol_leaf" /* 1/2 rank for symbol table leaf nodes */
-#define H5F_CRT_SYM_LEAF_DEF 4
-#define H5F_CRT_BTREE_RANK_NAME "btree_rank" /* 1/2 rank for btree internal nodes */
-#define H5F_CRT_ADDR_BYTE_NUM_NAME "addr_byte_num" /* Byte number in an address */
-#define H5F_CRT_OBJ_BYTE_NUM_NAME "obj_byte_num" /* Byte number for object size */
-#define H5F_CRT_SUPER_VERS_NAME "super_version" /* Version number of the superblock */
-#define H5F_CRT_SHMSG_NINDEXES_NAME "num_shmsg_indexes" /* Number of shared object header message indexes */
+#define H5F_CRT_USER_BLOCK_NAME "block_size" /* Size of the file user block in bytes */
+#define H5F_CRT_SYM_LEAF_NAME "symbol_leaf" /* 1/2 rank for symbol table leaf nodes */
+#define H5F_CRT_SYM_LEAF_DEF 4
+#define H5F_CRT_BTREE_RANK_NAME "btree_rank" /* 1/2 rank for btree internal nodes */
+#define H5F_CRT_ADDR_BYTE_NUM_NAME "addr_byte_num" /* Byte number in an address */
+#define H5F_CRT_OBJ_BYTE_NUM_NAME "obj_byte_num" /* Byte number for object size */
+#define H5F_CRT_SUPER_VERS_NAME "super_version" /* Version number of the superblock */
+/* Number of shared object header message indexes */
+#define H5F_CRT_SHMSG_NINDEXES_NAME "num_shmsg_indexes"
#define H5F_CRT_SHMSG_INDEX_TYPES_NAME "shmsg_message_types" /* Types of message in each index */
-#define H5F_CRT_SHMSG_INDEX_MINSIZE_NAME \
- "shmsg_message_minsize" /* Minimum size of messages in each index \
- */
+/* Minimum size of messages in each index */
+#define H5F_CRT_SHMSG_INDEX_MINSIZE_NAME "shmsg_message_minsize"
#define H5F_CRT_SHMSG_LIST_MAX_NAME "shmsg_list_max" /* Shared message list maximum size */
#define H5F_CRT_SHMSG_BTREE_MIN_NAME "shmsg_btree_min" /* Shared message B-tree minimum size */
#define H5F_CRT_FILE_SPACE_STRATEGY_NAME "file_space_strategy" /* File space handling strategy */
@@ -598,10 +611,10 @@ uint64_decode(uint8_t **pp)
#define H5F_ACS_CLEAR_STATUS_FLAGS_NAME \
"clear_status_flags" /* Whether to clear superblock status_flags (private property only used by h5clear) \
*/
-#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr" /* Nullify addresses of free-space managers */
- /* Private property used only by h5clear */
-#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check" /* Skip EOF check */
- /* Private property used only by h5clear */
+#define H5F_ACS_NULL_FSM_ADDR_NAME "null_fsm_addr" /* Nullify addresses of free-space managers */
+/* Private property used only by h5clear */
+#define H5F_ACS_SKIP_EOF_CHECK_NAME "skip_eof_check" /* Skip EOF check */
+/* Private property used only by h5clear */
#define H5F_ACS_USE_MDC_LOGGING_NAME "use_mdc_logging" /* Whether to use metadata cache logging */
#define H5F_ACS_MDC_LOG_LOCATION_NAME "mdc_log_location" /* Name of metadata cache log location */
#define H5F_ACS_START_MDC_LOG_ON_ACCESS_NAME \
@@ -634,11 +647,16 @@ uint64_decode(uint8_t **pp)
{ \
/* int32_t version = */ 0, /* int32_t tick_len = */ 0, \
/* int32_t max_lag = */ 0, /* hbool_t vfd_swmr_writer = */ FALSE, \
+ /* hbool_t maintain_metadata_file = */ FALSE, \
+ /* hbool_t generate_updater_files = */ FALSE, \
/* hbool_t flush_raw_data = */ FALSE, /* int32_t md_pages_reserved = */ 0, \
/* int32_t pb_expansion_threshold = */ 0, /* char md_file_path[] = */ "", \
- /* char log_file_path[] = */ "" \
+ /* char updater_file_path[] = */ "", /* char log_file_path[] = */ "" \
}
+/* For VFD SWMR testing only: private property to generate checksum for metadata file via callback */
+#define H5F_ACS_GENERATE_MD_CK_CB_NAME "generate md ck callback"
+
/* ======================== File Mount properties ====================*/
#define H5F_MNT_SYM_LOCAL_NAME "local" /* Whether absolute symlinks local to file. */
@@ -669,13 +687,13 @@ uint64_decode(uint8_t **pp)
#define HDF5_BTREE_SNODE_IK_DEF 16
#define HDF5_BTREE_CHUNK_IK_DEF \
32 /* Note! this value is assumed \
- to be 32 for version 0 \
- of the superblock and \
- if it is changed, the code \
- must compensate. -QAK \
- */
+ to be 32 for version 0 \
+ of the superblock and \
+ if it is changed, the code \
+ must compensate. -QAK \
+ */
#define HDF5_BTREE_IK_MAX_ENTRIES 65536 /* 2^16 - 2 bytes for storing entries (children) */
- /* See format specification on version 1 B-trees */
+/* See format specification on version 1 B-trees */
/* Default file space handling strategy */
#define H5F_FILE_SPACE_STRATEGY_DEF H5F_FSPACE_STRATEGY_FSM_AGGR
@@ -771,6 +789,72 @@ uint64_decode(uint8_t **pp)
#define H5SM_TABLE_MAGIC "SMTB" /* Shared Message Table */
#define H5SM_LIST_MAGIC "SMLI" /* Shared Message List */
+/*
+ * VFD SWMR
+ */
+
+/* Updater file header */
+#define H5F_UD_VERSION 0 /* Version of the updater file format */
+#define H5F_UD_HEADER_OFF 0 /* Updater file header offset */
+#define H5F_UD_HEADER_MAGIC "VUDH" /* Updater file header magic */
+#define H5F_SIZEOF_CHKSUM 4 /* Size of checksum */
+
+/* Flags in the updater file header */
+#define CREATE_METADATA_FILE_ONLY_FLAG 0x0001
+#define FINAL_UPDATE_FLAG 0x0002
+
+/* Size of updater file header */
+#define H5F_UD_HEADER_SIZE \
+ (H5_SIZEOF_MAGIC /* Signature */ \
+ + 2 /* Version number */ \
+ + 2 /* Flags */ \
+ + 4 /* Page size */ \
+ + 8 /* Sequence number */ \
+ + 8 /* Tick number */ \
+ + 8 /* Change list offset */ \
+ + 8 /* Change list length */ \
+ + H5F_SIZEOF_CHKSUM /* Updater file header checksum */ \
+ )
+
+#define H5F_UD_CL_MAGIC "VUCL" /* Updater file change list magic */
+
+/* Size of an updater file change list entry */
+#define H5F_UD_CL_ENTRY_SIZE \
+ (4 /* Updater file page offset */ \
+ + 4 /* Metadata file page offset */ \
+ + 4 /* HDF5 file page offset */ \
+ + 4 /* Length */ \
+ + H5F_SIZEOF_CHKSUM /* Updater file change list entry checksum */ \
+ )
+
+/* Size of updater file change list */
+#define H5F_UD_CL_SIZE(N) /* N is number of change list entries */ \
+ (H5_SIZEOF_MAGIC /* Signature */ \
+ + 8 /* Tick num */ \
+ + 4 /* Metadata file header updater file page offset */ \
+ + 4 /* Metadata file header length */ \
+ + 4 /* Metadata file header checksum */ \
+ + 4 /* Metadata file index updater file page offset */ \
+ + 8 /* Metadata file index metadata file offset */ \
+ + 4 /* Metadata file index length */ \
+ + 4 /* Metadata file index checksum */ \
+ + 4 /* Number of change list entries */ \
+ + (N * H5F_UD_CL_ENTRY_SIZE) /* Change list entries */ \
+ + H5F_SIZEOF_CHKSUM /* Updater file change list checksum */ \
+ )
+
+/*
+ * For VFD SWMR testing only:
+ */
+
+/* Callback routine to generate checksum for metadata file specified by md_path */
+typedef herr_t (*H5F_generate_md_ck_t)(char *md_path, uint64_t updater_seq_num);
+
+/* Structure for "generate checksum callback" private property */
+typedef struct H5F_generate_md_ck_cb_t {
+ H5F_generate_md_ck_t func;
+} H5F_generate_md_ck_cb_t;
+
/****************************/
/* Library Private Typedefs */
/****************************/
@@ -778,6 +862,7 @@ uint64_decode(uint8_t **pp)
/* Forward declarations (for prototypes & type definitions) */
struct H5B_class_t;
struct H5UC_t;
+struct H5G_loc_t;
struct H5O_loc_t;
struct H5HG_heap_t;
struct H5VL_class_t;
@@ -840,6 +925,180 @@ typedef enum H5F_prefix_open_t {
H5F_PREFIX_EFILE = 2 /* External file prefix */
} H5F_prefix_open_t;
+/*
+ * VFD SWMR
+ */
+
+/*----------------------------------------------------------------------------
+ *
+ * struct H5F_vfd_swmr_updater_cl_entry_t
+ *
+ * An array of instances of H5F_vfd_swmr_updater_cl_entry_t of length equal to
+ * the number of metadata pages and multi-page metadata entries modified in
+ * the past tick is used to assemble the associated data in preparation for
+ * writing an updater file.
+ *
+ * Each entry in this array pertains to a given modified metdata page or
+ * multi-page metadata entry, and contains the following fields:
+ *
+ * entry_image_ptr: void pointer to a buffer containing the image of the
+ * target metadata page or multi-page metadata entry as modified in
+ * this tick, or NULL if undefined.
+ *
+ * entry_image_ud_file_page_offset: Page offset of the entry in the
+ * updater file, or 0 if undefined.
+ *
+ * entry_image_md_file_page_offset: Page offset of the entry in the
+ * metadata file, or 0 if undefined.
+ *
+ * entry_image_h5_file_page_offset: Page offset of the entry in the
+ * HDF5 file. In this case, a page offset of zero is valid,
+ * so we havd no easy marker for an invalid value. Instead,
+ * presume that this field is invalid if the entry_image_md_file_page_offset
+ * is invalid.
+ *
+ * entry_image_len: The size of the metadata page or multi-page metadata
+ * entry in bytes.
+ * entry_image_checksum: Checksum of the entry image.
+ *
+ *----------------------------------------------------------------------------
+ */
+typedef struct H5F_vfd_swmr_updater_cl_entry_t {
+ void * entry_image_ptr;
+ uint32_t entry_image_ud_file_page_offset;
+ uint32_t entry_image_md_file_page_offset;
+ uint32_t entry_image_h5_file_page_offset;
+ size_t entry_image_len;
+ uint32_t entry_image_checksum;
+} H5F_vfd_swmr_updater_cl_entry_t;
+
+/*----------------------------------------------------------------------------
+ *
+ * struct H5F_vfd_swmr_updater_t
+ *
+ * Instances of this structure are used to assemble the data required to
+ * write a metadata file updater file.
+ *
+ * Updater file header related fields:
+ *
+ * version: Version of the updater file format to be used. At present this
+ * must be zero.
+ *
+ * flags: This field contains any flags to be set in the updater file header.
+ * Currently defined flags are:
+ *
+ * 0x0001 CREATE_METADATA_FILE_ONLY_FLAG
+ * If set, the auxiliary process should create the metadata file,
+ * but leave it empty. This flag may only be set if sequence_num
+ * is zero.
+ *
+ * 0x0002 FINAL_UPDATE_FLAG
+ * If set, the VFD SWMR writer is closing the target file, and this
+ * updater contains the final set of updates to the metadata file.
+ * On receipt, the auxiliary process should apply the enclosed
+ * changes to the metadata file, unlink it, and exit.
+ *
+ * sequence_num: This field contains the sequence number of this updater file.
+ * The sequence number of the first updater file must be zero, and
+ * this sequence number must be increased by one for each new updater
+ * file. Note that under some circumstances, the sequence number
+ * will not match the tick_num.
+ *
+ * tick_num: Number of the tick for which this updater file is to be generated.
+ * This value should match that of the index used to fill our this
+ * structure.
+ *
+ * header_image_ptr: void pointer to the buffer in which the
+ * updater file header is constructed.
+ * This field is NULL if the buffer is undefined.
+ *
+ * header_image_len: This field contains the length of the updater file
+ * header in bytes.
+ *
+ * change_list_image_ptr: void pointer to a buffer containing the on disk image
+ * of the updater file change list, or NULL if that buffer does not exist.
+ *
+ * change_list_offset: This field contains the offset in bytes of the change
+ * list in the updater file. This will typically be the offset of
+ * the first byte in the updater file after the header.
+ *
+ * change_list_len: This field contains the size in bytes of the on disk image
+ * of the change list in the updater file.
+ *
+ * Updater File Change List Related Fields:
+ *
+ * The updater file change list is a section of the updater file that details the
+ * locations and lengths of all metadata file entries that must be modified for
+ * this tick.
+ *
+ * md_file_header_image_ptr: void pointer to a buffer containing the on disk image
+ * of the metadata file header as updated for tick_num.
+ *
+ * md_file_header_ud_file_page_offset: This field contains the updater file
+ * page offset of the metadata file header image. Note that we do
+ * not store the metadata file page offset of the metadata file header,
+ * as it is always written to offset 0 in the metadata file.
+ *
+ * md_file_header_len: This field contains the size of the metadata file header
+ * image in bytes.
+ *
+ * md_file_index_image: void pointer to a buffer containing the on disk image
+ * of the metadata file index as updated for tick_num.
+ *
+ * md_file_index_md_file_offset: This field contains the offset of the
+ * metadata file index in the metadata file in bytes.
+ *
+ * This value will either be the size of the metadata file header
+ * (if the metadata file header and index are adjacent), or a page
+ * aligned value.
+ *
+ * md_file_index_ud_file_page_offset: This field contains the page offset of the
+ * metadata file index in the updater file.
+ *
+ * md_file_index_len: This field contains the size of the metadata file index in
+ * bytes.
+ *
+ * num_change_list_entries: This field contains the number of entries in the
+ * array of H5F_vfd_swmr_updater_cl_ entry_t whose base address
+ * is stored in the change_list field below. This value is also the
+ * number of metadata pages and multi-page metadata entries that have
+ * been modified in the past tick.
+ *
+ * If this field is zero, there is no change list, and the change_list
+ * field below is NULL.
+ *
+ * change_list: This field contains the base address of a dynamically allocated
+ * array of H5F_vfd_swmr_updater_cl_entry_t of length num_change_list_entries,
+ * or NULL if undefined.
+ *
+ *----------------------------------------------------------------------------
+ */
+typedef struct H5F_vfd_swmr_updater_t {
+ /* Updater file header related fields */
+ uint16_t version;
+ uint16_t flags;
+ uint32_t page_size;
+ uint64_t sequence_number;
+ uint64_t tick_num;
+ void * header_image_ptr;
+ size_t header_image_len;
+ void * change_list_image_ptr;
+ uint64_t change_list_offset;
+ size_t change_list_len;
+ /* Updater file change list related fields */
+ void * md_file_header_image_ptr;
+ uint32_t md_file_header_image_chksum;
+ uint32_t md_file_header_ud_file_page_offset;
+ size_t md_file_header_len;
+ void * md_file_index_image_ptr;
+ uint32_t md_file_index_image_chksum;
+ uint64_t md_file_index_md_file_offset;
+ uint32_t md_file_index_ud_file_page_offset;
+ size_t md_file_index_len;
+ uint32_t num_change_list_entries;
+ H5F_vfd_swmr_updater_cl_entry_t *change_list;
+} H5F_vfd_swmr_updater_t;
+
/*****************************/
/* Library-private Variables */
/*****************************/
@@ -853,7 +1112,6 @@ H5_DLL herr_t H5F_init(void);
H5_DLL H5F_t *H5F_open(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id);
H5_DLL herr_t H5F_try_close(H5F_t *f, hbool_t *was_closed /*out*/);
H5_DLL hid_t H5F_get_file_id(H5VL_object_t *vol_obj, H5I_type_t obj_type, hbool_t app_ref);
-H5_DLL herr_t H5F_delete(const char *filename, hid_t fapl_id);
/* Functions that retrieve values from the file struct */
H5_DLL H5F_libver_t H5F_get_low_bound(const H5F_t *f);
@@ -931,7 +1189,12 @@ H5_DLL haddr_t H5F_shared_get_eoa(const H5F_shared_t *f_sh, H5FD_mem_t type);
H5_DLL haddr_t H5F_get_eoa(const H5F_t *f, H5FD_mem_t type);
H5_DLL herr_t H5F_get_vfd_handle(const H5F_t *file, hid_t fapl, void **file_handle);
-/* Functions that check file mounting information */
+/* VFD SWMR functions */
+H5_DLL hbool_t H5F_use_vfd_swmr(const H5F_t *f);
+
+/* File mounting routines */
+H5_DLL herr_t H5F_mount(const struct H5G_loc_t *loc, const char *name, H5F_t *child, hid_t plist_id);
+H5_DLL herr_t H5F_unmount(const struct H5G_loc_t *loc, const char *name);
H5_DLL hbool_t H5F_is_mount(const H5F_t *file);
H5_DLL hbool_t H5F_has_mount(const H5F_t *file);
H5_DLL herr_t H5F_traverse_mount(struct H5O_loc_t *oloc /*in,out*/);
@@ -984,8 +1247,6 @@ H5_DLL MPI_Comm H5F_mpi_get_comm(const H5F_t *f);
H5_DLL int H5F_shared_mpi_get_size(const H5F_shared_t *f_sh);
H5_DLL int H5F_mpi_get_size(const H5F_t *f);
H5_DLL herr_t H5F_mpi_retrieve_comm(hid_t loc_id, hid_t acspl_id, MPI_Comm *mpi_comm);
-H5_DLL herr_t H5F_get_mpi_atomicity(H5F_t *file, hbool_t *flag);
-H5_DLL herr_t H5F_set_mpi_atomicity(H5F_t *file, hbool_t flag);
#endif /* H5_HAVE_PARALLEL */
/* External file cache routines */
@@ -1005,6 +1266,4 @@ H5_DLL herr_t H5F_cwfs_remove_heap(H5F_shared_t *shared, struct H5HG_heap_t *hea
/* Debugging functions */
H5_DLL herr_t H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth);
-H5_DLL hbool_t H5F_use_vfd_swmr(const H5F_t *f);
-
#endif /* H5Fprivate_H */
diff --git a/src/H5Fpublic.h b/src/H5Fpublic.h
index 48bfaaa..7120085 100644
--- a/src/H5Fpublic.h
+++ b/src/H5Fpublic.h
@@ -275,6 +275,31 @@ typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata);
* A boolean flag indicating whether the file opened with this FAPL entry
* will be opened R/W. (i.e. as a VFD SWMR writer)
*
+ * maintain_metadata_file
+ * A boolean flag indicating whether the writer should create and
+ * maintain the metadata file. Note that this field is only revelant
+ * if the above writer flag is TRUE.
+ * If this flag is TRUE, the writer must create and maintain the
+ * metadata file in the location specified in the md_file_path.
+ * Observe that at least one of maintain_metadata_file and
+ * generate_updater_files fields must be TRUE if writer is TRUE.
+ *
+ * generate_updater_files
+ * A boolean flag indicating whether the writer should generate a
+ * sequence of updater files describing how the metadata file
+ * should be updated at the end of each tick.
+ * If the flag is TRUE, all modifications to the metadata file
+ * (including its creation) are described in an ordered sequence of
+ * updater files. These files are read in order by auxiliary processes,
+ * and used to generate local copies of the metadata file as required.
+ * This mechanism exists to allow VFD SWMR to operate on storage
+ * systems that do not support POSIX semantics.
+ * This field is only used by the VFD SWMR writer. VFD SWMR readers
+ * ignore this field, as they always look to the specified metadata
+ * file, regardless of whether it is generated and maintained
+ * directly by the VFD SWMR writer, or by an auxiliary process that
+ * polls for new updater files, and applies them as they appear.
+ *
* flush_raw_data:
* A boolean flag indicating whether raw data should be flushed
* as part of the end of tick processing. If set to TRUE, raw
@@ -307,11 +332,16 @@ typedef herr_t (*H5F_flush_cb_t)(hid_t object_id, void *udata);
* of tick is triggered.
*
* md_file_path:
- * POSIX: this field contains the path of the metadata file.
- * NFS: it contains the path and base name of the metadata file
- * updater files.
- * Object store: it contains the base URL for the objects used
- * to store metadata file updater objects.
+ * If both the writer and maintain_metadata_file fields are TRUE, this
+ * field contains the path of the metadata file.
+ * If writer is FALSE, this field contains the path of the (possibly
+ * local copy of the) metadata file.
+ *
+ * updater_file_path:
+ * If generate_updater_files is TRUE, the contents of this field depends
+ * on whether the writer field is TRUE. If it is, the field contains
+ * the path and base name of the metadatea file updater files.
+ * If writer is FALSE, the field is ignored.
*
* log_file_path:
* This field contains the path to the log file. If defined, this path should
@@ -324,10 +354,13 @@ typedef struct H5F_vfd_swmr_config_t {
uint32_t tick_len;
uint32_t max_lag;
hbool_t writer;
+ hbool_t maintain_metadata_file;
+ hbool_t generate_updater_files;
hbool_t flush_raw_data;
uint32_t md_pages_reserved;
uint32_t pb_expansion_threshold;
char md_file_path[H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1];
+ char updater_file_path[H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1];
char log_file_path[H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1];
} H5F_vfd_swmr_config_t;
@@ -1114,7 +1147,7 @@ H5_DLL herr_t H5Fget_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
* \since 1.8.0
*
*/
-H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, H5AC_cache_config_t *config_ptr);
+H5_DLL herr_t H5Fset_mdc_config(hid_t file_id, const H5AC_cache_config_t *config_ptr);
/**
* \ingroup MDC
*
@@ -1888,6 +1921,7 @@ H5_DLL herr_t H5Fset_mpi_atomicity(hid_t file_id, hbool_t flag);
H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#endif /* H5_HAVE_PARALLEL */
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1907,6 +1941,7 @@ H5_DLL herr_t H5Fget_mpi_atomicity(hid_t file_id, hbool_t *flag);
#define H5Fflush_async_wrap H5_NO_EXPAND(H5Fflush_async)
#define H5Fclose_async_wrap H5_NO_EXPAND(H5Fclose_async)
#endif /* H5F_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5Ftest.c b/src/H5Ftest.c
index b76c579..f4a89fd 100644
--- a/src/H5Ftest.c
+++ b/src/H5Ftest.c
@@ -344,24 +344,10 @@ H5F__vfd_swmr_writer_create_open_flush_test(hid_t file_id, hbool_t file_create)
/* Verify the minimum size for the metadata file */
if (HDstat(f->shared->vfd_swmr_config.md_file_path, &stat_buf) < 0)
HGOTO_ERROR(H5E_FILE, H5E_BADFILE, FAIL, "unable to stat the metadata file")
- if (stat_buf.st_size <
- (HDoff_t)((hsize_t)f->shared->vfd_swmr_config.md_pages_reserved * f->shared->fs_page_size))
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect metadata file size")
if (file_create) { /* Creating file */
- uint32_t hdr_magic;
-
- /* Seek to the beginning of the file */
- if (HDlseek(md_fd, (HDoff_t)H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "error seeking metadata file")
-
- /* Try to read the magic for header */
- if (HDread(md_fd, &hdr_magic, H5_SIZEOF_MAGIC) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "error reading metadata file")
-
- /* Verify that there is no header magic in the metadata file */
- if (HDmemcmp(&hdr_magic, H5FD_MD_HEADER_MAGIC, (size_t)H5_SIZEOF_MAGIC) == 0)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "error finding header magic in the metadata file")
+ if (stat_buf.st_size != 0)
+ HGOTO_ERROR(H5E_FILE, H5E_READERROR, FAIL, "metadata file should be empty for file create")
}
else { /* Opening or flushing the file */
@@ -494,7 +480,7 @@ H5F__vfd_swmr_decode_md_idx(int md_fd, H5FD_vfd_swmr_md_header *md_hdr, H5FD_vfd
UINT32DECODE(p, md_idx->entries[i].hdf5_page_offset);
UINT32DECODE(p, md_idx->entries[i].md_file_page_offset);
UINT32DECODE(p, md_idx->entries[i].length);
- UINT32DECODE(p, md_idx->entries[i].chksum);
+ UINT32DECODE(p, md_idx->entries[i].checksum);
} /* end for */
} /* end if */
@@ -546,7 +532,7 @@ H5F__vfd_swmr_verify_md_hdr_and_idx(H5F_t *f, H5FD_vfd_swmr_md_header *md_hdr, H
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect index_length read from metadata file")
/* Verify index_offset read from header in the metadata file is the size of md header */
- if (md_hdr->index_offset != f->shared->fs_page_size)
+ if (md_hdr->index_offset != H5FD_MD_HEADER_SIZE)
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect index_offset read from metadata file")
/* Verify num_entries read from index in the metadata file is num_entries */
@@ -573,8 +559,8 @@ H5F__vfd_swmr_verify_md_hdr_and_idx(H5F_t *f, H5FD_vfd_swmr_md_header *md_hdr, H
HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL,
"incorrect md_file_page_offset read from metadata file")
- if (md_idx->entries[i].chksum != index[i].chksum)
- HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect chksum read from metadata file")
+ if (md_idx->entries[i].checksum != index[i].checksum)
+ HGOTO_ERROR(H5E_FILE, H5E_BADVALUE, FAIL, "incorrect checksum read from metadata file")
}
}
diff --git a/src/H5Fvfd_swmr.c b/src/H5Fvfd_swmr.c
index d7cb830..43567ac 100644
--- a/src/H5Fvfd_swmr.c
+++ b/src/H5Fvfd_swmr.c
@@ -25,6 +25,7 @@
/****************/
#include "H5Fmodule.h" /* This source code file is part of the H5F module */
+#define H5FD_FRIEND /*suppress error about including H5FDpkg */
/***********/
/* Headers */
@@ -36,7 +37,7 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5Fpkg.h" /* File access */
-#include "H5FDprivate.h" /* File drivers */
+#include "H5FDpkg.h" /* File drivers */
#include "H5Gprivate.h" /* Groups */
#include "H5Iprivate.h" /* IDs */
#include "H5Lprivate.h" /* Links */
@@ -54,18 +55,63 @@
#define nanosecs_per_second 1000000000 /* nanoseconds per second */
#define nanosecs_per_tenth_sec 100000000 /* nanoseconds per 0.1 second */
+/* Declare an array of string to identify the VFD SMWR Log tags.
+ * Note this array is used to generate the entry tag by the log reporting macro
+ * H5F_POST_VFD_SWMR_LOG_ENTRY.
+ *
+ * The following is the first version. Developers can add/modify the tags as necessary.
+ *
+ * If the entry code is 0, H5Fvfd_swmr_log_tags[0] is used to report the entry tag.
+ * H5F_POST_VFD_SWMR_LOG_ENTRY(f, EOT_PROCESSING_TIME, log_msg) will put the log_msg attached to
+ * the entry tag "EOT_PROCESSING_TIME".
+ * The entry code number is listed in the comment for convenience.
+ * Currently for the production mode, only the "EOT_PROCESSING_TIME" is present.
+ */
+
+/* clang-format off */
+static const char *H5Fvfd_swmr_log_tags[] = {
+ "EOT_PROCESSING_TIME", /* 0 */
+ "FILE_OPEN", /* 1 */
+ "FILE_CLOSE", /* 2 */
+ "EOT_TRIGGER_TIME", /* 3 */
+ "EOT_META_FILE_INDEX" /* 4 */
+ };
+/* clang-format on */
+
+/* This string defines the format of the VFD SWMR log file.
+ * The current maximum length of entry tag string is set to 26.
+ * One can enlarge or reduce this number as necessary.
+ * For example, to enlarge the maximum length of entry tag string to 30,
+ * Just change 26 to 30 in the following line, like
+ * const char *log_fmt_str="%-30s: %.3lf s: %s\n";
+ */
+const char *log_fmt_str = "%-26s: %.3lf s: %s\n";
+
+/* The length of the EOT processing time log message, subject to change */
+const unsigned int eot_pt_log_mesg_length = 48;
+
+/* The length of error message in the log */
+const unsigned int log_err_mesg_length = 14;
+
/********************/
/* Local Prototypes */
/********************/
static herr_t H5F__vfd_swmr_update_end_of_tick_and_tick_num(H5F_shared_t *, hbool_t);
-static herr_t H5F__vfd_swmr_construct_write_md_hdr(H5F_shared_t *, uint32_t);
+static herr_t H5F__vfd_swmr_construct_write_md_hdr(H5F_shared_t *, uint32_t, uint8_t *);
static herr_t H5F__vfd_swmr_construct_write_md_idx(H5F_shared_t *, uint32_t,
- struct H5FD_vfd_swmr_idx_entry_t[]);
+ struct H5FD_vfd_swmr_idx_entry_t[], uint8_t *);
static herr_t H5F__idx_entry_cmp(const void *_entry1, const void *_entry2);
static herr_t H5F__vfd_swmr_create_index(H5F_shared_t *);
static herr_t H5F__vfd_swmr_writer__wait_a_tick(H5F_t *);
+static herr_t H5F__vfd_swmr_construct_ud_hdr(H5F_vfd_swmr_updater_t *updater);
+static herr_t H5F__vfd_swmr_construct_ud_cl(H5F_vfd_swmr_updater_t *updater);
+static herr_t H5F__generate_updater_file(H5F_t *f, uint32_t num_entries, uint16_t flags,
+ uint8_t *md_file_hdr_image_ptr, size_t md_file_hdr_image_len,
+ uint8_t *md_file_index_image_ptr, uint64_t md_file_index_offset,
+ size_t md_file_index_image_len);
+
/*********************/
/* Package Variables */
/*********************/
@@ -132,10 +178,12 @@ H5FL_DEFINE(eot_queue_entry_t);
herr_t
H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create)
{
- hsize_t md_size; /* Size of the metadata file */
- haddr_t hdr_addr, idx_addr; /* Addresses returned from H5MV_alloc() */
- herr_t ret_value = SUCCEED; /* Return value */
- H5F_shared_t *shared = f->shared;
+ hsize_t md_size; /* Size of the metadata file */
+ haddr_t hdr_addr; /* Address returned from H5MV_alloc() */
+ H5F_shared_t *shared = f->shared;
+ uint8_t md_idx_image[H5FD_MD_INDEX_SIZE(0)]; /* Buffer for metadata file index */
+ uint8_t md_hdr_image[H5FD_MD_HEADER_SIZE]; /* Buffer for metadata file header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -146,57 +194,59 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create)
if (H5F_SHARED_INTENT(shared) & H5F_ACC_RDWR) {
HDassert(shared->vfd_swmr_config.writer);
+ HDassert(shared->vfd_swmr_config.maintain_metadata_file ||
+ shared->vfd_swmr_config.generate_updater_files);
SIMPLEQ_INIT(&shared->lower_defrees);
shared->vfd_swmr_writer = TRUE;
- shared->tick_num = 1;
-
- if (H5PB_vfd_swmr__set_tick(shared) < 0)
- HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "Can't update page buffer current tick")
+ shared->tick_num = 0;
/* Create the metadata file */
- if (((shared->vfd_swmr_md_fd = HDopen(shared->vfd_swmr_config.md_file_path, O_CREAT | O_RDWR,
- H5_POSIX_CREATE_MODE_RW))) < 0)
-
+ if (((shared->vfd_swmr_md_fd = HDopen(shared->vfd_swmr_config.md_file_path,
+ O_CREAT | O_RDWR | O_TRUNC, H5_POSIX_CREATE_MODE_RW))) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTOPENFILE, FAIL, "unable to create the metadata file")
md_size = (hsize_t)shared->vfd_swmr_config.md_pages_reserved * shared->fs_page_size;
- HDassert(shared->fs_page_size >= H5FD_MD_HEADER_SIZE);
-
- /* Allocate an entire page from the shadow file for the header. */
- if ((hdr_addr = H5MV_alloc(f, shared->fs_page_size)) == HADDR_UNDEF) {
+ if ((hdr_addr = H5MV_alloc(f, md_size)) == HADDR_UNDEF) {
HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error allocating shadow-file header");
}
HDassert(H5F_addr_eq(hdr_addr, H5FD_MD_HEADER_OFF));
- idx_addr = H5MV_alloc(f, md_size - shared->fs_page_size);
- if (idx_addr == HADDR_UNDEF) {
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error allocating shadow-file index");
- }
-
- HDassert(H5F_addr_eq(idx_addr, shared->fs_page_size));
-
- shared->writer_index_offset = idx_addr;
-
- /* Set the metadata file size to md_pages_reserved */
- if (-1 == HDftruncate(shared->vfd_swmr_md_fd, (HDoff_t)md_size))
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "truncate fail for the metadata file");
-
- /* Set eof for metadata file to md_pages_reserved */
- shared->vfd_swmr_md_eoa = (haddr_t)md_size;
+ shared->writer_index_offset = H5FD_MD_HEADER_SIZE;
+ shared->vfd_swmr_md_eoa = (haddr_t)md_size;
/* When opening an existing HDF5 file, create header and empty
* index in the metadata file
*/
if (!file_create) {
- if (H5F__vfd_swmr_construct_write_md_idx(shared, 0, NULL) < 0)
+ if (H5F__vfd_swmr_construct_write_md_idx(shared, 0, NULL, md_idx_image) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to create index in md");
- if (H5F__vfd_swmr_construct_write_md_hdr(shared, 0) < 0)
+ if (H5F__vfd_swmr_construct_write_md_hdr(shared, 0, md_hdr_image) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to create header in md");
}
+
+ /* For VFD SWMR testing: invoke callback if set to generate metadata file checksum */
+ if (shared->generate_md_ck_cb) {
+ if (shared->generate_md_ck_cb(shared->vfd_swmr_config.md_file_path, shared->updater_seq_num) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "error from generate_md_ck_cb()")
+ }
+
+ /* Generate updater files if configuration indicates so */
+ if (shared->vfd_swmr_config.generate_updater_files) {
+ shared->updater_seq_num = 0;
+ if (H5F__generate_updater_file(f, 0, file_create ? CREATE_METADATA_FILE_ONLY_FLAG : 0,
+ md_hdr_image, H5FD_MD_HEADER_SIZE, md_idx_image,
+ shared->writer_index_offset, H5FD_MD_INDEX_SIZE(0)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "can't generate updater file")
+ }
+
+ shared->tick_num = 1;
+
+ if (H5PB_vfd_swmr__set_tick(shared) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "Can't update page buffer current tick")
}
else { /* VFD SWMR reader */
@@ -217,7 +267,6 @@ H5F_vfd_swmr_init(H5F_t *f, hbool_t file_create)
&(shared->mdf_idx_entries_used), shared->mdf_idx) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTLOAD, FAIL, "unable to load/decode metadata file");
- HDassert(shared->tick_num != 0);
vfd_swmr_reader_did_increase_tick_to(shared->tick_num);
#if 0 /* JRM */
@@ -273,6 +322,8 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing)
{
H5F_shared_t * shared = f->shared;
shadow_defree_t *curr;
+ uint8_t md_idx_image[H5FD_MD_INDEX_SIZE(0)]; /* Buffer for metadata file index */
+ uint8_t md_hdr_image[H5FD_MD_HEADER_SIZE]; /* Buffer for metadata file header */
herr_t ret_value = SUCCEED;
FUNC_ENTER_NOAPI(FAIL)
@@ -281,22 +332,26 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing)
HDassert(shared->vfd_swmr_md_fd >= 0);
/* Write empty index to the md file */
- if (H5F__vfd_swmr_construct_write_md_idx(shared, 0, NULL) < 0)
+ if (H5F__vfd_swmr_construct_write_md_idx(shared, 0, NULL, md_idx_image) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to create index in md");
/* Write header to the md file */
- if (H5F__vfd_swmr_construct_write_md_hdr(shared, 0) < 0)
+ if (H5F__vfd_swmr_construct_write_md_hdr(shared, 0, md_hdr_image) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to create header in md");
if (closing) { /* For file close */
- ++shared->tick_num;
-
/* Close the md file */
if (HDclose(shared->vfd_swmr_md_fd) < 0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close the metadata file");
shared->vfd_swmr_md_fd = -1;
+ /* For VFD SWMR testing: invoke callback if set to generate metadata file checksum */
+ if (shared->generate_md_ck_cb) {
+ if (shared->generate_md_ck_cb(shared->vfd_swmr_config.md_file_path, shared->updater_seq_num) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "error from generate_md_ck_cb()")
+ }
+
/* Unlink the md file */
if (HDunlink(shared->vfd_swmr_config.md_file_path) < 0)
HSYS_GOTO_ERROR(H5E_FILE, H5E_CANTREMOVE, FAIL, "unable to unlink the metadata file");
@@ -313,13 +368,34 @@ H5F_vfd_swmr_close_or_flush(H5F_t *f, hbool_t closing)
}
HDassert(TAILQ_EMPTY(&shared->shadow_defrees));
+
+ if (shared->vfd_swmr_config.generate_updater_files) {
+ if (H5F__generate_updater_file(f, 0, FINAL_UPDATE_FLAG, md_hdr_image, H5FD_MD_HEADER_SIZE,
+ md_idx_image, shared->writer_index_offset,
+ H5FD_MD_INDEX_SIZE(0)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "can't generate updater file")
+ }
}
else { /* For file flush */
/* Update end_of_tick */
if (H5F__vfd_swmr_update_end_of_tick_and_tick_num(shared, TRUE) < 0)
HDONE_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to update end of tick");
}
+#if 1 /*Kent Save the end of close info. to the log file, subject to comment out. */
+ if (closing)
+ H5F_POST_VFD_SWMR_LOG_ENTRY(f, FILE_CLOSE, "VFD SWMR File close ends");
+#endif
done:
+
+ /* Kent: Stop the timer and close the VFD SWMR log file if it is turned on.
+ * Please REVIEW to ensure this is the right place to
+ * close the log file.
+ */
+ if (shared->vfd_swmr_log_on && closing) {
+ H5_timer_stop(&(shared->vfd_swmr_log_start_time));
+ HDfclose(shared->vfd_swmr_log_file_ptr);
+ }
+ /* Kent */
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -385,9 +461,11 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, H5FD_vfd_swmr_
H5F_shared_t * shared = f->shared;
shadow_defree_t *prev;
shadow_defree_t *shadow_defree;
- haddr_t md_addr; /* Address in the metadata file */
- uint32_t i; /* Local index variable */
- herr_t ret_value = SUCCEED; /* Return value */
+ haddr_t md_addr; /* Address in the metadata file */
+ uint32_t i; /* Local index variable */
+ uint8_t * md_idx_image = NULL;
+ uint8_t md_hdr_image[H5FD_MD_HEADER_SIZE]; /* Buffer for metadata file header */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -409,13 +487,15 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, H5FD_vfd_swmr_
* --Compute checksum, update the index entry, write entry to
* the metadata file
*
- * --Set entry_ptr to NULL
+ * --Set entry_ptr to NULL when not generating updater files
*/
for (i = 0; i < num_entries; i++) {
if (index[i].entry_ptr == NULL)
continue;
+ HDassert(index[i].tick_of_last_change == f->shared->tick_num);
+
/* Prepend previous image of the entry to the delayed list */
if (index[i].md_file_page_offset) {
if (shadow_image_defer_free(shared, &index[i]) == -1) {
@@ -431,16 +511,16 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, H5FD_vfd_swmr_
/* Compute checksum and update the index entry */
index[i].md_file_page_offset = md_addr / shared->fs_page_size;
- index[i].chksum = H5_checksum_metadata(index[i].entry_ptr, index[i].length, 0);
+ index[i].checksum = H5_checksum_metadata(index[i].entry_ptr, index[i].length, 0);
#if 0 /* JRM */
HDfprintf(stderr,
- "writing index[%d] fo/mdfo/l/chksum/fc/lc = %lld/%lld/%ld/%lx/%lx/%lx\n",
+ "writing index[%d] fo/mdfo/l/checksum/fc/lc = %lld/%lld/%ld/%lx/%lx/%lx\n",
i,
index[i].hdf5_page_offset,
index[i].md_file_page_offset,
index[i].length,
- index[i].chksum,
+ index[i].checksum,
(((char*)(index[i].entry_ptr))[0]),
(((char*)(index[i].entry_ptr))[4095]));
@@ -449,26 +529,34 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, H5FD_vfd_swmr_
HDassert(shared->fs_page_size == 4096);
#endif /* JRM */
- /* Seek and write the entry to the metadata file */
- if (HDlseek(shared->vfd_swmr_md_fd, (HDoff_t)md_addr, SEEK_SET) < 0)
+ if (shared->vfd_swmr_config.maintain_metadata_file) {
- HGOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "unable to seek in the metadata file")
+ /* Seek and write the entry to the metadata file */
+ if (HDlseek(shared->vfd_swmr_md_fd, (HDoff_t)md_addr, SEEK_SET) < 0)
- if (HDwrite(shared->vfd_swmr_md_fd, index[i].entry_ptr, index[i].length) != (ssize_t)index[i].length)
+ HGOTO_ERROR(H5E_FILE, H5E_SEEKERROR, FAIL, "unable to seek in the metadata file")
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
- "error in writing the page/multi-page entry to metadata file")
+ if (HDwrite(shared->vfd_swmr_md_fd, index[i].entry_ptr, index[i].length) !=
+ (ssize_t)index[i].length)
+
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL,
+ "error in writing the page/multi-page entry to metadata file")
+ }
- index[i].entry_ptr = NULL;
+ if (!shared->vfd_swmr_config.generate_updater_files)
+ index[i].entry_ptr = NULL;
}
+ if ((md_idx_image = HDmalloc(H5FD_MD_INDEX_SIZE(num_entries))) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for md index")
+
/* Construct and write index to the metadata file */
- if (H5F__vfd_swmr_construct_write_md_idx(shared, num_entries, index) < 0)
+ if (H5F__vfd_swmr_construct_write_md_idx(shared, num_entries, index, md_idx_image) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to construct & write index to md")
/* Construct and write header to the md file */
- if (H5F__vfd_swmr_construct_write_md_hdr(shared, num_entries) < 0)
+ if (H5F__vfd_swmr_construct_write_md_hdr(shared, num_entries, md_hdr_image) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to construct & write header to md")
@@ -483,26 +571,45 @@ H5F_update_vfd_swmr_metadata_file(H5F_t *f, uint32_t num_entries, H5FD_vfd_swmr_
* --remove the associated entries from the list
*/
- if (shared->tick_num <= shared->vfd_swmr_config.max_lag)
- goto done; // It is too early for any reclamations to be due.
+ /* if (shared->tick_num <= shared->vfd_swmr_config.max_lag),
+ it is too early for any reclamations to be due.
+ */
+ if (shared->tick_num > shared->vfd_swmr_config.max_lag) {
- TAILQ_FOREACH_REVERSE_SAFE(shadow_defree, &shared->shadow_defrees, shadow_defree_queue, link, prev)
- {
+ TAILQ_FOREACH_REVERSE_SAFE(shadow_defree, &shared->shadow_defrees, shadow_defree_queue, link, prev)
+ {
- if (shadow_defree->tick_num + shared->vfd_swmr_config.max_lag > shared->tick_num) {
- break; // No more entries are due for reclamation.
- }
+ if (shadow_defree->tick_num + shared->vfd_swmr_config.max_lag > shared->tick_num) {
+ break; // No more entries are due for reclamation.
+ }
- if (H5MV_free(f, shadow_defree->offset, shadow_defree->length) < 0) {
- HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry");
- }
+ if (H5MV_free(f, shadow_defree->offset, shadow_defree->length) < 0) {
+ HGOTO_ERROR(H5E_CACHE, H5E_CANTFLUSH, FAIL, "unable to flush clean entry");
+ }
+
+ TAILQ_REMOVE(&shared->shadow_defrees, shadow_defree, link);
- TAILQ_REMOVE(&shared->shadow_defrees, shadow_defree, link);
+ H5FL_FREE(shadow_defree_t, shadow_defree);
+ }
+ }
- H5FL_FREE(shadow_defree_t, shadow_defree);
+ /* For VFD SWMR testing: invoke callback if set to generate metadata file checksum */
+ if (shared->generate_md_ck_cb) {
+ if (shared->generate_md_ck_cb(shared->vfd_swmr_config.md_file_path, shared->updater_seq_num) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "error from generate_md_ck_cb()")
}
+ /* Generate updater files with num_entries */
+ if (shared->vfd_swmr_config.generate_updater_files)
+ if (H5F__generate_updater_file(f, num_entries, 0, md_hdr_image, H5FD_MD_HEADER_SIZE, md_idx_image,
+ shared->writer_index_offset, H5FD_MD_INDEX_SIZE(num_entries)) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL, "can't generate updater file")
+
done:
+
+ if (md_idx_image)
+ HDfree(md_idx_image);
+
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_update_vfd_swmr_metadata_file() */
@@ -755,12 +862,28 @@ H5F_vfd_swmr_writer_end_of_tick(H5F_t *f, hbool_t wait_for_reader)
herr_t ret_value = SUCCEED; /* Return value */
hbool_t incr_tick = FALSE;
+ /* Kent: define the local variables to calculate the EOT time
+ and write them to the log file. */
+ H5_timevals_t current_time;
+ double start_elapsed_time, end_elapsed_time;
+ unsigned int temp_time;
+ char * log_msg;
+
FUNC_ENTER_NOAPI(FAIL)
HDassert(shared);
HDassert(shared->page_buf);
HDassert(shared->vfd_swmr_writer);
+ /* Kent */
+ /* Obtain the starting time for the logging info: the processing time of this function. */
+ if (shared->vfd_swmr_log_on == true) {
+ if (H5_timer_get_times(shared->vfd_swmr_log_start_time, &current_time) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time from H5_timer_get_times")
+ start_elapsed_time = current_time.elapsed;
+ }
+ /* Kent */
+
if (!vfd_swmr_writer_may_increase_tick_to(shared->tick_num + 1, wait_for_reader))
goto update_eot;
@@ -883,6 +1006,19 @@ update_eot:
HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "unable to insert entry into the EOT queue")
done:
+ /* Kent: Calcuate the processing time and write the time info to the log file */
+ if (shared->vfd_swmr_log_on == true) {
+ if (H5_timer_get_times(shared->vfd_swmr_log_start_time, &current_time) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTGET, FAIL, "can't get time from H5_timer_get_times")
+ end_elapsed_time = current_time.elapsed;
+ if (NULL != (log_msg = HDmalloc(eot_pt_log_mesg_length * sizeof(char)))) {
+ temp_time = (unsigned int)((end_elapsed_time - start_elapsed_time) * 1000);
+ HDsprintf(log_msg, "Writer time is %u milliseconds", temp_time);
+ H5F_POST_VFD_SWMR_LOG_ENTRY(f, EOT_PROCESSING_TIME, log_msg);
+ HDfree(log_msg);
+ }
+ }
+ /* Kent */
FUNC_LEAVE_NOAPI(ret_value)
}
@@ -1014,7 +1150,19 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, hbool_t entering_api)
/* This is ok if we're entering the API, but it should
* not happen if we're exiting the API.
*/
+ /* JRM review this */
+ /* The following line is added for more meaningful error message when
+ * the long running API on the reader side exceeds the max_lag of ticks.
+ * KY 2021-09-02
+ * */
+ if (!entering_api && tmp_tick_num >= shared->tick_num + shared->vfd_swmr_config.max_lag) {
+ HGOTO_ERROR(H5E_FILE, H5E_SYSTEM, FAIL,
+ "Reader's API time exceeds max_lag of ticks, may increase the value of max_lag.");
+ }
+#if 0 /* Kent */
+ /* The original code */
HDassert(entering_api || tmp_tick_num < shared->tick_num + shared->vfd_swmr_config.max_lag);
+#endif
if (!entering_api) {
H5FD_vfd_swmr_record_elapsed_ticks(shared->lf, tmp_tick_num - shared->tick_num);
@@ -1102,7 +1250,14 @@ H5F_vfd_swmr_reader_end_of_tick(H5F_t *f, hbool_t entering_api)
* case where the new entry is *longer*, because the
* extension could overlap with a second entry.
*/
+
+ /* JRM review this */
+ /* Kent: need to comment out the line to make reader iterate
+ * a large number of groups
+ * */
+#if 0 /*Kent*/
HDassert(oent->length == nent->length);
+#endif
/* the page has been altered -- evict it and
* any contained metadata cache entries.
@@ -1472,11 +1627,10 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5F__vfd_swmr_construct_write_md_hdr(H5F_shared_t *shared, uint32_t num_entries)
+H5F__vfd_swmr_construct_write_md_hdr(H5F_shared_t *shared, uint32_t num_entries, uint8_t *image)
{
- uint8_t image[H5FD_MD_HEADER_SIZE]; /* Buffer for header */
- uint8_t *p = NULL; /* Pointer to buffer */
- uint32_t metadata_chksum; /* Computed metadata checksum value */
+ uint8_t *p = NULL; /* Pointer to buffer */
+ uint32_t metadata_chksum; /* Computed metadata checksum value */
/* Size of header and index */
const size_t hdr_size = H5FD_MD_HEADER_SIZE;
ssize_t nwritten;
@@ -1508,15 +1662,17 @@ H5F__vfd_swmr_construct_write_md_hdr(H5F_shared_t *shared, uint32_t num_entries)
/* Sanity checks on header */
HDassert(p - image == (ptrdiff_t)hdr_size);
- /* Set to beginning of the file */
- if (HDlseek(shared->vfd_swmr_md_fd, H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
+ if (shared->vfd_swmr_config.maintain_metadata_file) {
+ /* Set to beginning of the file */
+ if (HDlseek(shared->vfd_swmr_md_fd, H5FD_MD_HEADER_OFF, SEEK_SET) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file")
+ HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file")
- nwritten = HDwrite(shared->vfd_swmr_md_fd, image, hdr_size);
- /* Write header to the metadata file */
- if (nwritten != (ssize_t)hdr_size) {
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing header to metadata file")
+ nwritten = HDwrite(shared->vfd_swmr_md_fd, image, hdr_size);
+ /* Write header to the metadata file */
+ if (nwritten != (ssize_t)hdr_size) {
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing header to metadata file")
+ }
}
done:
@@ -1549,10 +1705,9 @@ done:
*/
static herr_t
H5F__vfd_swmr_construct_write_md_idx(H5F_shared_t *shared, uint32_t num_entries,
- struct H5FD_vfd_swmr_idx_entry_t index[])
+ struct H5FD_vfd_swmr_idx_entry_t index[], uint8_t *image)
{
- uint8_t *image = NULL; /* Pointer to buffer */
- uint8_t *p = NULL; /* Pointer to buffer */
+ uint8_t *p = NULL; /* Pointer to buffer */
uint32_t metadata_chksum; /* Computed metadata checksum value */
/* Size of index */
const size_t idx_size = H5FD_MD_INDEX_SIZE(num_entries);
@@ -1564,11 +1719,6 @@ H5F__vfd_swmr_construct_write_md_idx(H5F_shared_t *shared, uint32_t num_entries,
HDassert(num_entries == 0 || index != NULL);
- /* Allocate space for the buffer to hold the index */
- if ((image = HDmalloc(idx_size)) == NULL)
-
- HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for md index")
-
/*
* Encode metadata file index
*/
@@ -1589,7 +1739,7 @@ H5F__vfd_swmr_construct_write_md_idx(H5F_shared_t *shared, uint32_t num_entries,
UINT32ENCODE(p, index[i].hdf5_page_offset);
UINT32ENCODE(p, index[i].md_file_page_offset);
UINT32ENCODE(p, index[i].length);
- UINT32ENCODE(p, index[i].chksum);
+ UINT32ENCODE(p, index[i].checksum);
}
/* Calculate checksum for index */
@@ -1604,22 +1754,20 @@ H5F__vfd_swmr_construct_write_md_idx(H5F_shared_t *shared, uint32_t num_entries,
/* Verify the md file descriptor exists */
HDassert(shared->vfd_swmr_md_fd >= 0);
- if (HDlseek(shared->vfd_swmr_md_fd, (HDoff_t)shared->writer_index_offset, SEEK_SET) < 0)
- HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file")
+ if (shared->vfd_swmr_config.maintain_metadata_file) {
+
+ if (HDlseek(shared->vfd_swmr_md_fd, (HDoff_t)shared->writer_index_offset, SEEK_SET) < 0)
+ HGOTO_ERROR(H5E_VFL, H5E_SEEKERROR, FAIL, "unable to seek in metadata file")
- nwritten = HDwrite(shared->vfd_swmr_md_fd, image, idx_size);
- /* Write index to the metadata file */
- if (nwritten != (ssize_t)idx_size) {
- HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing index to metadata file")
+ nwritten = HDwrite(shared->vfd_swmr_md_fd, image, idx_size);
+ /* Write index to the metadata file */
+ if (nwritten != (ssize_t)idx_size) {
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "error in writing index to metadata file")
+ }
}
done:
- if (image) {
-
- HDfree(image);
- }
-
FUNC_LEAVE_NOAPI(ret_value)
} /* H5F__vfd_swmr_construct_write_idx() */
@@ -1867,3 +2015,434 @@ H5F_vfd_swmr_process_eot_queue(hbool_t entering_api)
done:
FUNC_LEAVE_NOAPI(ret_value)
}
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5F_post_vfd_swmr_log_entry
+ *
+ * Purpose: Write the log information to the log file.
+ *
+ * Parameters:
+ * H5F_t *f IN: HDF5 file pointer
+ * int entry_type_code IN: The entry type code to identify the
+ * log entry tag.
+ * char *log_info IN: The information to be stored in the
+ * log file.
+ * Return: None
+ *
+ *-------------------------------------------------------------------------
+ */
+
+void
+H5F_post_vfd_swmr_log_entry(H5F_t *f, int entry_type_code, char *log_info)
+{
+ double temp_time;
+ H5_timevals_t current_time;
+ char * gettime_error;
+
+ /* Obtain the current time.
+ If failed, write an error message to the log file.
+ else obtain the elapsed time in seconds since the log file
+ was created and write the time to the log file. */
+ if (H5_timer_get_times(f->shared->vfd_swmr_log_start_time, &current_time) < 0) {
+ if (NULL != (gettime_error = HDmalloc(log_err_mesg_length * sizeof(char)))) {
+ HDsprintf(gettime_error, "gettime_error");
+ HDfprintf(f->shared->vfd_swmr_log_file_ptr, "%-26s: %s\n", H5Fvfd_swmr_log_tags[entry_type_code],
+ gettime_error);
+ HDfree(gettime_error);
+ }
+ }
+ else {
+ temp_time = current_time.elapsed;
+ HDfprintf(f->shared->vfd_swmr_log_file_ptr, log_fmt_str, H5Fvfd_swmr_log_tags[entry_type_code],
+ temp_time, log_info);
+ }
+ return;
+}
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5F__vfd_swmr_construct_ud_hdr
+ *
+ * Purpose: Encode updater header in the buffer updater->header_image_ptr
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Vailin Choi -- 10/2021
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F__vfd_swmr_construct_ud_hdr(H5F_vfd_swmr_updater_t *updater)
+{
+ uint8_t *p = NULL; /* Pointer to buffer */
+ uint8_t *image = (uint8_t *)updater->header_image_ptr;
+ uint32_t metadata_chksum; /* Computed metadata checksum value */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /*
+ * Encode metadata file header
+ */
+ p = image;
+
+ /* Encode magic for header */
+ HDmemcpy(p, H5F_UD_HEADER_MAGIC, (size_t)H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
+
+ /* Encode version number, flags, page size, sequence number, tick number, change list offset, change list
+ * length */
+ UINT16ENCODE(p, H5F_UD_VERSION);
+ UINT16ENCODE(p, updater->flags);
+ UINT32ENCODE(p, updater->page_size);
+ UINT64ENCODE(p, updater->sequence_number);
+ UINT64ENCODE(p, updater->tick_num);
+
+ UINT64ENCODE(p, updater->change_list_offset);
+ UINT64ENCODE(p, updater->change_list_len);
+
+ /* Calculate checksum for header */
+ metadata_chksum = H5_checksum_metadata(image, (size_t)(p - image), 0);
+
+ /* Encode checksum for header */
+ UINT32ENCODE(p, metadata_chksum);
+
+ /* Sanity checks on header */
+ HDassert(p - image == (ptrdiff_t)updater->header_image_len);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* H5F__vfd_swmr_construct_ud_hdr() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5F__vfd_swmr_construct_ud_cl
+ *
+ * Purpose: Encode updater change list in the buffer
+ * updater->change_list_image_ptr
+ *
+ * Return: Success: SUCCEED
+ * Failure: FAIL
+ *
+ * Programmer: Vailin Choi -- 10/2021
+ *
+ * Changes: None.
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F__vfd_swmr_construct_ud_cl(H5F_vfd_swmr_updater_t *updater)
+{
+ uint8_t *p = NULL; /* Pointer to buffer */
+ uint8_t *image = (uint8_t *)updater->change_list_image_ptr;
+ uint32_t metadata_chksum; /* Computed metadata checksum value */
+ unsigned i; /* Local index variable */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /*
+ * Encode ud cl
+ */
+ p = image;
+
+ /* Encode magic for ud cl */
+ HDmemcpy(p, H5F_UD_CL_MAGIC, H5_SIZEOF_MAGIC);
+ p += H5_SIZEOF_MAGIC;
+
+ /* Encode tick number */
+ UINT64ENCODE(p, updater->tick_num);
+
+ /* Encode Metadata File Header Updater File Page Offset*/
+ UINT32ENCODE(p, updater->md_file_header_ud_file_page_offset);
+
+ /* Encode Metadata File Header Length */
+ UINT32ENCODE(p, updater->md_file_header_len);
+
+ /* Calculate checksum on the image of the metadata file header */
+ updater->md_file_header_image_chksum =
+ H5_checksum_metadata(updater->md_file_header_image_ptr, (size_t)updater->md_file_header_len, 0);
+
+ /* Encode Metadata File Header Checksum */
+ UINT32ENCODE(p, updater->md_file_header_image_chksum);
+
+ /* Encode Metadata File Index Updater File Page Offset*/
+ UINT32ENCODE(p, updater->md_file_index_ud_file_page_offset);
+
+ /* Encode Metadata File Index Metadata File Offset */
+ UINT64ENCODE(p, updater->md_file_index_md_file_offset);
+
+ /* Encode Metadata File Index Length */
+ UINT32ENCODE(p, updater->md_file_index_len);
+
+ /* Calculate checksum on the image of the metadata file index */
+ updater->md_file_index_image_chksum =
+ H5_checksum_metadata(updater->md_file_index_image_ptr, (size_t)updater->md_file_index_len, 0);
+
+ /* Encode Metadata File Index Checksum */
+ UINT32ENCODE(p, updater->md_file_index_image_chksum);
+
+ UINT32ENCODE(p, updater->num_change_list_entries);
+
+ /* Encode the ud cl entries */
+ for (i = 0; i < updater->num_change_list_entries; i++) {
+ UINT32ENCODE(p, updater->change_list[i].entry_image_ud_file_page_offset);
+ UINT32ENCODE(p, updater->change_list[i].entry_image_md_file_page_offset);
+ UINT32ENCODE(p, updater->change_list[i].entry_image_h5_file_page_offset);
+ UINT32ENCODE(p, updater->change_list[i].entry_image_len);
+ UINT32ENCODE(p, updater->change_list[i].entry_image_checksum);
+ }
+
+ /* Calculate checksum for ud cl */
+ metadata_chksum = H5_checksum_metadata(image, (size_t)(p - image), 0);
+
+ /* Encode checksum for index */
+ UINT32ENCODE(p, metadata_chksum);
+
+ /* Sanity checks on index */
+ HDassert(p - image == (ptrdiff_t)updater->change_list_len);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* H5F__vfd_swmr_construct_ud_cl() */
+
+/*-------------------------------------------------------------------------
+ *
+ * Function: H5F_generate_updater_file()
+ *
+ * Purpose: Generate updater file:
+ * --assemble and initialize data in the updater struct
+ * --determine num_change_list entries
+ * --allocate buffers
+ * --construct on disk image (serialize) of the updater header and change list
+ * --create updater file using a temporay file name:
+ * --<shared->vfd_swmr_config.updater_file_path>.ud_tmp
+ * --allocate space and write the following to the updater file
+ * --updater file header
+ * --updater file change list
+ * --metadata entries
+ * --metadata file index
+ * --metadata file header
+ * --close the updater file
+ * --rename the updater file with the correct name:
+ * <shared->vfd_swmr_config.updater_file_path>.<shared->updater_seq_num>
+ *
+ * --increment shared->updater_seq_num
+ * --free buffers
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Vailin Choi 8/24/2021
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5F__generate_updater_file(H5F_t *f, uint32_t num_entries, uint16_t flags, uint8_t *md_file_hdr_image_ptr,
+ size_t md_file_hdr_image_len, uint8_t *md_file_index_image_ptr,
+ uint64_t md_file_index_offset, size_t md_file_index_image_len)
+{
+ H5F_shared_t * shared = f->shared; /* shared file pointer */
+ H5F_vfd_swmr_updater_t updater; /* Updater struct */
+ uint32_t next_page_offset;
+ H5FD_t * ud_file = NULL; /* Low-level file struct */
+ char namebuf[H5F__MAX_VFD_SWMR_FILE_NAME_LEN];
+ char newname[H5F__MAX_VFD_SWMR_FILE_NAME_LEN];
+ unsigned i, j;
+ hsize_t alloc_size;
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Updater file header fields */
+ updater.version = H5F_UD_VERSION;
+ updater.flags = flags;
+ updater.page_size = (uint32_t)shared->fs_page_size;
+ updater.sequence_number = shared->updater_seq_num;
+ updater.tick_num = shared->tick_num;
+ updater.header_image_ptr = NULL;
+ updater.header_image_len = H5F_UD_HEADER_SIZE;
+ updater.change_list_image_ptr = NULL;
+ updater.change_list_offset = 0;
+ updater.change_list_len = 0;
+
+ /* Updater file change list fields */
+
+ /* md_file_header related fields */
+ updater.md_file_header_ud_file_page_offset = 0;
+ updater.md_file_header_image_ptr = md_file_hdr_image_ptr; /* parameter */
+ updater.md_file_header_len = md_file_hdr_image_len; /* parameter */
+
+ /* md_file_index related fields */
+ updater.md_file_index_ud_file_page_offset = 0;
+ updater.md_file_index_image_ptr = md_file_index_image_ptr; /* parameter */
+ updater.md_file_index_md_file_offset = md_file_index_offset; /* parameter */
+ updater.md_file_index_len = md_file_index_image_len; /* parameter */
+
+ updater.num_change_list_entries = 0;
+ updater.change_list = NULL;
+
+ /* Scan index to determine updater.num_change_list_entries */
+ for (i = 0; i < num_entries; i++) {
+ if (shared->mdf_idx[i].entry_ptr != NULL &&
+ shared->mdf_idx[i].tick_of_last_change == shared->tick_num)
+ updater.num_change_list_entries += 1;
+ }
+
+ if (flags == CREATE_METADATA_FILE_ONLY_FLAG)
+ HDassert(updater.sequence_number == 0);
+ /* For file creation, just generate a header with this flag set */
+ else {
+ /* Update 2 updater file header fields: change_list_len, change_list_offset */
+ updater.change_list_len = H5F_UD_CL_SIZE(updater.num_change_list_entries);
+ updater.change_list_offset = updater.header_image_len;
+ }
+
+ /* Create the updater file with a temporary file name */
+ HDsprintf(namebuf, "%s.ud_tmp", shared->vfd_swmr_config.updater_file_path);
+
+ if ((ud_file = H5FD_open(namebuf, H5F_ACC_TRUNC | H5F_ACC_RDWR | H5F_ACC_CREAT, H5P_FILE_ACCESS_DEFAULT,
+ HADDR_UNDEF)) == NULL)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "fail to open updater file");
+
+ if ((updater.header_image_ptr = HDmalloc(updater.header_image_len)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for ud header")
+
+ /* Serialize updater file hdr in updater.header_image_ptr */
+ if (H5F__vfd_swmr_construct_ud_hdr(&updater) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to create updater file header ");
+
+ /* Allocate space in updater file for updater file header */
+ if (H5FD__alloc_real(ud_file, H5FD_MEM_DEFAULT, updater.header_image_len, NULL, NULL) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file memory")
+
+ /* Write updater file header */
+ if (H5FD_write(ud_file, H5FD_MEM_DEFAULT, H5F_UD_HEADER_OFF, updater.header_image_len,
+ updater.header_image_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "ud file write failed")
+
+ if (flags != CREATE_METADATA_FILE_ONLY_FLAG) {
+
+ next_page_offset =
+ ((uint32_t)(updater.header_image_len + updater.change_list_len) / updater.page_size) + 1;
+
+ if (updater.num_change_list_entries) {
+
+ /* Allocate space for change list entries */
+ if ((updater.change_list = HDmalloc(sizeof(H5F_vfd_swmr_updater_cl_entry_t) *
+ updater.num_change_list_entries)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for ud cl")
+
+ /* Initialize change list entries */
+ i = 0;
+ for (j = 0; j < num_entries; j++) {
+
+ if (shared->mdf_idx[j].entry_ptr != NULL &&
+ shared->mdf_idx[j].tick_of_last_change == shared->tick_num) {
+
+ updater.change_list[i].entry_image_ptr = shared->mdf_idx[j].entry_ptr;
+ updater.change_list[i].entry_image_ud_file_page_offset = 0;
+ updater.change_list[i].entry_image_md_file_page_offset =
+ (uint32_t)shared->mdf_idx[j].md_file_page_offset;
+ updater.change_list[i].entry_image_h5_file_page_offset =
+ (uint32_t)shared->mdf_idx[j].hdf5_page_offset;
+ updater.change_list[i].entry_image_len = shared->mdf_idx[j].length;
+ updater.change_list[i].entry_image_checksum = shared->mdf_idx[j].checksum;
+
+ shared->mdf_idx[j].entry_ptr = NULL;
+ i++;
+ }
+ }
+
+ /* Set up page aligned space for all metadata pages */
+ for (i = 0; i < updater.num_change_list_entries; i++) {
+ updater.change_list[i].entry_image_ud_file_page_offset = next_page_offset;
+ next_page_offset +=
+ (((uint32_t)updater.change_list[i].entry_image_len / updater.page_size) + 1);
+ }
+ }
+
+ /* Set up page aligned space for the metadata file index */
+ updater.md_file_index_ud_file_page_offset = next_page_offset;
+
+ /* Set up page aligned space for the metadata file header */
+ next_page_offset += (((uint32_t)updater.md_file_index_len / updater.page_size) + 1);
+ updater.md_file_header_ud_file_page_offset = next_page_offset;
+
+ if ((updater.change_list_image_ptr = HDmalloc(updater.change_list_len)) == NULL)
+ HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for ud cl ")
+
+ /* Serialize updater file change list in updater.change_list_image_ptr */
+ if (H5F__vfd_swmr_construct_ud_cl(&updater) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "fail to create updater file cl");
+
+ /* Allocate space in updater file for updater file change list */
+ if (H5FD__alloc_real(ud_file, H5FD_MEM_DEFAULT, updater.header_image_len + updater.change_list_len,
+ NULL, NULL) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file memory")
+
+ /* Write updater file change list */
+ if (H5FD_write(ud_file, H5FD_MEM_DEFAULT, updater.header_image_len, updater.change_list_len,
+ updater.change_list_image_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "ud file write failed")
+
+ /* Allocate and write metadata pages */
+ for (i = 0; i < updater.num_change_list_entries; i++) {
+ alloc_size = updater.change_list[i].entry_image_ud_file_page_offset * updater.page_size +
+ updater.change_list[i].entry_image_len;
+
+ if (H5FD__alloc_real(ud_file, H5FD_MEM_DEFAULT, alloc_size, NULL, NULL) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file memory")
+
+ if (H5FD_write(ud_file, H5FD_MEM_DEFAULT,
+ updater.change_list[i].entry_image_ud_file_page_offset * updater.page_size,
+ updater.change_list[i].entry_image_len,
+ updater.change_list[i].entry_image_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "ud file write failed")
+ }
+
+ /* Allocate and write metadata file index */
+ alloc_size =
+ updater.md_file_index_ud_file_page_offset * updater.page_size + updater.md_file_index_len;
+ if (H5FD__alloc_real(ud_file, H5FD_MEM_DEFAULT, alloc_size, NULL, NULL) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file memory")
+
+ if (H5FD_write(ud_file, H5FD_MEM_DEFAULT,
+ updater.md_file_index_ud_file_page_offset * updater.page_size,
+ updater.md_file_index_len, updater.md_file_index_image_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "ud file write failed")
+
+ /* Allocate and write metadata file header */
+ alloc_size =
+ updater.md_file_header_ud_file_page_offset * updater.page_size + updater.md_file_header_len;
+ if (H5FD__alloc_real(ud_file, H5FD_MEM_DEFAULT, alloc_size, NULL, NULL) == HADDR_UNDEF)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "unable to allocate file memory")
+
+ if (H5FD_write(ud_file, H5FD_MEM_DEFAULT,
+ updater.md_file_header_ud_file_page_offset * updater.page_size,
+ updater.md_file_header_len, updater.md_file_header_image_ptr) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_WRITEERROR, FAIL, "ud file write failed")
+ }
+
+ /* Close the updater file and rename the file */
+ if (H5FD_close(ud_file) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCLOSEFILE, FAIL, "unable to close updater file")
+ HDsprintf(newname, "%s.%lu", shared->vfd_swmr_config.updater_file_path, shared->updater_seq_num);
+ HDrename(namebuf, newname);
+
+ ++shared->updater_seq_num;
+
+done:
+ if (updater.header_image_ptr)
+ HDfree(updater.header_image_ptr);
+ if (updater.change_list_image_ptr)
+ HDfree(updater.change_list_image_ptr);
+ if (updater.change_list)
+ HDfree(updater.change_list);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+
+} /* H5F__generate_updater_file() */
diff --git a/src/H5G.c b/src/H5G.c
index 45ba023..deaf792 100644
--- a/src/H5G.c
+++ b/src/H5G.c
@@ -502,8 +502,9 @@ done:
hid_t
H5Gget_create_plist(hid_t group_id)
{
- H5VL_object_t *vol_obj = NULL;
- hid_t ret_value = H5I_INVALID_HID;
+ H5VL_object_t * vol_obj; /* Object for loc_id */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ hid_t ret_value = H5I_INVALID_HID;
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", group_id);
@@ -512,11 +513,17 @@ H5Gget_create_plist(hid_t group_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(group_id, H5I_GROUP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a group ID")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_GCPL;
+ vol_cb_args.args.get_gcpl.gcpl_id = H5I_INVALID_HID;
+
/* Get the group creation property list for the group */
- if (H5VL_group_get(vol_obj, H5VL_GROUP_GET_GCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &ret_value) <
- 0)
+ if (H5VL_group_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, H5I_INVALID_HID, "can't get group's creation property list")
+ /* Set the return value */
+ ret_value = vol_cb_args.args.get_gcpl.gcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Gget_create_plist() */
@@ -538,9 +545,9 @@ H5G__get_info_api_common(hid_t loc_id, H5G_info_t *group_info /*out*/, void **to
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -551,13 +558,14 @@ H5G__get_info_api_common(hid_t loc_id, H5G_info_t *group_info /*out*/, void **to
if (!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
- /* Set up object access arguments */
- if (H5VL_setup_self_args(loc_id, vol_obj_ptr, &loc_params) < 0)
+ /* 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_ptr, &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 = group_info;
/* Retrieve group information */
- if (H5VL_group_get(*vol_obj_ptr, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params,
- group_info) < 0)
+ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -647,8 +655,8 @@ H5G__get_info_by_name_api_common(hid_t loc_id, const char *name, H5G_info_t *gro
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -656,13 +664,15 @@ H5G__get_info_by_name_api_common(hid_t loc_id, const char *name, H5G_info_t *gro
if (!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
- /* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ /* Set up VOL callback & object access arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_INFO;
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr,
+ &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 = group_info;
/* Retrieve group information */
- if (H5VL_group_get(*vol_obj_ptr, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params,
- group_info) < 0)
+ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -754,8 +764,8 @@ H5G__get_info_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_group_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -763,14 +773,15 @@ H5G__get_info_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t
if (!group_info)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "group_info parameter cannot be NULL")
- /* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr,
- &loc_params) < 0)
+ /* Set up VOL callback & object access arguments */
+ vol_cb_args.op_type = H5VL_GROUP_GET_INFO;
+ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr,
+ &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 = group_info;
/* Retrieve group information */
- if (H5VL_group_get(*vol_obj_ptr, H5VL_GROUP_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params,
- group_info) < 0)
+ if (H5VL_group_get(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "unable to get group info")
done:
@@ -957,8 +968,9 @@ done:
herr_t
H5Gflush(hid_t group_id)
{
- H5VL_object_t *vol_obj; /* Group for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", group_id);
@@ -971,9 +983,12 @@ H5Gflush(hid_t group_id)
if (H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_FLUSH;
+ vol_cb_args.args.flush.grp_id = group_id;
+
/* Flush group's metadata to file */
- if (H5VL_group_specific(vol_obj, H5VL_GROUP_FLUSH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, group_id) <
- 0)
+ if (H5VL_group_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
done:
@@ -995,8 +1010,9 @@ done:
herr_t
H5Grefresh(hid_t group_id)
{
- H5VL_object_t *vol_obj; /* Group for this operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_group_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", group_id);
@@ -1009,9 +1025,12 @@ H5Grefresh(hid_t group_id)
if (H5CX_set_loc(group_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTSET, FAIL, "can't set collective metadata read info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_REFRESH;
+ vol_cb_args.args.refresh.grp_id = group_id;
+
/* Refresh group's metadata */
- if (H5VL_group_specific(vol_obj, H5VL_GROUP_REFRESH, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- group_id) < 0)
+ if (H5VL_group_specific(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
done:
diff --git a/src/H5Gcompact.c b/src/H5Gcompact.c
index a621f6e..0c0b5db 100644
--- a/src/H5Gcompact.c
+++ b/src/H5Gcompact.c
@@ -200,20 +200,20 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative, length of name
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sep 6, 2005
*
*-------------------------------------------------------------------------
*/
-ssize_t
+herr_t
H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t idx, char *name, size_t size)
+ H5_iter_order_t order, hsize_t idx, char *name, size_t name_size,
+ size_t *name_len)
{
H5G_link_table_t ltable = {0, NULL}; /* Link table */
- ssize_t ret_value = -1; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -229,13 +229,13 @@ H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
/* Get the length of the name */
- ret_value = (ssize_t)HDstrlen(ltable.lnks[idx].name);
+ *name_len = HDstrlen(ltable.lnks[idx].name);
/* Copy the name into the user's buffer, if given */
if (name) {
- HDstrncpy(name, ltable.lnks[idx].name, MIN((size_t)(ret_value + 1), size));
- if ((size_t)ret_value >= size)
- name[size - 1] = '\0';
+ HDstrncpy(name, ltable.lnks[idx].name, MIN((*name_len + 1), name_size));
+ if (*name_len >= name_size)
+ name[name_size - 1] = '\0';
} /* end if */
done:
diff --git a/src/H5Gdense.c b/src/H5Gdense.c
index ec5cb71..753936b 100644
--- a/src/H5Gdense.c
+++ b/src/H5Gdense.c
@@ -169,7 +169,7 @@ typedef struct {
size_t name_size; /* Size of name buffer to fill */
/* upward */
- ssize_t name_len; /* Full length of name */
+ size_t name_len; /* Full length of name */
} H5G_bt2_ud_gnbi_t;
/*
@@ -185,7 +185,7 @@ typedef struct {
size_t name_size; /* Size of name buffer to fill */
/* upward */
- ssize_t name_len; /* Full length of name */
+ size_t name_len; /* Full length of name */
} H5G_fh_ud_gnbi_t;
/*
@@ -1046,12 +1046,12 @@ H5G__dense_get_name_by_idx_fh_cb(const void *obj, size_t obj_len, void *_udata)
HGOTO_ERROR(H5E_SYM, H5E_CANTDECODE, FAIL, "can't decode link")
/* Get the length of the name */
- udata->name_len = (ssize_t)HDstrlen(lnk->name);
+ udata->name_len = HDstrlen(lnk->name);
/* Copy the name into the user's buffer, if given */
if (udata->name) {
- HDstrncpy(udata->name, lnk->name, MIN((size_t)(udata->name_len + 1), udata->name_size));
- if ((size_t)udata->name_len >= udata->name_size)
+ HDstrncpy(udata->name, lnk->name, MIN((udata->name_len + 1), udata->name_size));
+ if (udata->name_len >= udata->name_size)
udata->name[udata->name_size - 1] = '\0';
} /* end if */
@@ -1106,23 +1106,22 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative, length of name
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Sep 19 2006
*
*-------------------------------------------------------------------------
*/
-ssize_t
+herr_t
H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, char *name, size_t size)
+ hsize_t n, char *name, size_t name_size, size_t *name_len)
{
- H5HF_t * fheap = NULL; /* Fractal heap handle */
- H5G_link_table_t ltable = {0, NULL}; /* Table of links */
- H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
- haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
- ssize_t ret_value = -1; /* Return value */
+ H5HF_t * fheap = NULL; /* Fractal heap handle */
+ H5G_link_table_t ltable = {0, NULL}; /* Table of links */
+ H5B2_t * bt2 = NULL; /* v2 B-tree handle for index */
+ haddr_t bt2_addr; /* Address of v2 B-tree to use for lookup */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -1176,14 +1175,14 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5
udata.f = f;
udata.fheap = fheap;
udata.name = name;
- udata.name_size = size;
+ udata.name_size = name_size;
/* Retrieve the name according to the v2 B-tree's index order */
if (H5B2_index(bt2, order, n, H5G__dense_get_name_by_idx_bt2_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLIST, FAIL, "can't locate object in v2 B-tree")
/* Set return value */
- ret_value = udata.name_len;
+ *name_len = udata.name_len;
} /* end if */
else { /* Otherwise, we need to build a table of the links and sort it */
/* Build the table of links for this group */
@@ -1195,13 +1194,13 @@ H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type, H5
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "index out of bound")
/* Get the length of the name */
- ret_value = (ssize_t)HDstrlen(ltable.lnks[n].name);
+ *name_len = HDstrlen(ltable.lnks[n].name);
/* Copy the name into the user's buffer, if given */
if (name) {
- HDstrncpy(name, ltable.lnks[n].name, MIN((size_t)(ret_value + 1), size));
- if ((size_t)ret_value >= size)
- name[size - 1] = '\0';
+ HDstrncpy(name, ltable.lnks[n].name, MIN((*name_len + 1), name_size));
+ if (*name_len >= name_size)
+ name[name_size - 1] = '\0';
} /* end if */
} /* end else */
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 */
diff --git a/src/H5Gloc.c b/src/H5Gloc.c
index 7d08b54..2844c66 100644
--- a/src/H5Gloc.c
+++ b/src/H5Gloc.c
@@ -53,12 +53,6 @@ typedef struct {
H5G_loc_t *loc; /* Group location to set */
} H5G_loc_fnd_t;
-/* User data for checking if an object exists */
-typedef struct {
- /* upward */
- htri_t exists; /* Whether the object exists */
-} H5G_loc_exists_t;
-
/* User data for looking up an object in a group by index */
typedef struct {
/* downward */
@@ -103,7 +97,7 @@ typedef struct {
size_t bufsize; /* Size of object comment buffer */
/* upward */
- ssize_t comment_size; /* Actual size of object comment */
+ size_t comment_size; /* Actual size of object comment */
} H5G_loc_gc_t;
/********************/
@@ -616,24 +610,26 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_
const H5O_link_t H5_ATTR_UNUSED *lnk, H5G_loc_t *obj_loc, void *_udata /*in,out*/,
H5G_own_loc_t *own_loc /*out*/)
{
- H5G_loc_exists_t *udata = (H5G_loc_exists_t *)_udata; /* User data passed in */
+ hbool_t *exists = (hbool_t *)_udata; /* User data passed in */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC_NOERR
+ FUNC_ENTER_STATIC
/* Check if the name in this group resolved to a valid object */
if (obj_loc == NULL)
if (lnk)
- udata->exists = FALSE;
+ *exists = FALSE;
else
- udata->exists = FAIL;
+ HGOTO_ERROR(H5E_SYM, H5E_INTERNAL, FAIL, "no object or link info?")
else
- udata->exists = TRUE;
+ *exists = TRUE;
/* Indicate that this callback didn't take ownership of the group *
* location for the object */
*own_loc = H5G_OWN_NONE;
- FUNC_LEAVE_NOAPI(SUCCEED)
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G__loc_exists_cb() */
/*-------------------------------------------------------------------------
@@ -649,28 +645,22 @@ H5G__loc_exists_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_ATTR_
*
*-------------------------------------------------------------------------
*/
-htri_t
-H5G_loc_exists(const H5G_loc_t *loc, const char *name)
+herr_t
+H5G_loc_exists(const H5G_loc_t *loc, const char *name, hbool_t *exists)
{
- H5G_loc_exists_t udata; /* User data for traversal callback */
- htri_t ret_value = FAIL; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Check args. */
HDassert(loc);
HDassert(name && *name);
-
- /* Set up user data for locating object */
- udata.exists = FALSE;
+ HDassert(exists);
/* Traverse group hierarchy to locate object */
- if (H5G_traverse(loc, name, H5G_TARGET_EXISTS, H5G__loc_exists_cb, &udata) < 0)
+ if (H5G_traverse(loc, name, H5G_TARGET_EXISTS, H5G__loc_exists_cb, exists) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't check if object exists")
- /* Set return value */
- ret_value = udata.exists;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_loc_exists() */
@@ -1024,7 +1014,7 @@ H5G__loc_get_comment_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_
else {
if (udata->comment && udata->bufsize)
HDstrncpy(udata->comment, comment.s, udata->bufsize);
- udata->comment_size = (ssize_t)HDstrlen(comment.s);
+ udata->comment_size = HDstrlen(comment.s);
H5O_msg_reset(H5O_NAME_ID, &comment);
}
@@ -1043,22 +1033,19 @@ done:
* Purpose: Retrieve the information for an object from a group location
* and path to that object
*
- * Return: Success: Number of bytes in the comment excluding the
- * null terminator. Zero if the object has no
- * comment.
- *
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Quincey Koziol
* Thursday, August 30, 2007
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/, size_t bufsize)
+herr_t
+H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/, size_t bufsize,
+ size_t *comment_len)
{
- H5G_loc_gc_t udata; /* User data for traversal callback */
- ssize_t ret_value = -1; /* Return value */
+ H5G_loc_gc_t udata; /* User data for traversal callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -1069,14 +1056,15 @@ H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*
/* Set up user data for locating object */
udata.comment = comment;
udata.bufsize = bufsize;
- udata.comment_size = (-1);
+ udata.comment_size = 0;
/* Traverse group hierarchy to locate object */
if (H5G_traverse(loc, name, H5G_TARGET_NORMAL, H5G__loc_get_comment_cb, &udata) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't find object")
- /* Set the return value */
- ret_value = udata.comment_size;
+ /* Set value to return */
+ if (comment_len)
+ *comment_len = udata.comment_size;
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5Gmodule.h b/src/H5Gmodule.h
index fe26bd2..a0e121d 100644
--- a/src/H5Gmodule.h
+++ b/src/H5Gmodule.h
@@ -29,8 +29,29 @@
#define H5_MY_PKG_ERR H5E_SYM
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5G H5G
+/** \defgroup H5G H5G
+ *
+ * Use the functions in this module to manage HDF5 groups.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5G_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5G_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5G_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5G_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
* \details \Bold{Groups in HDF5:} A group associates names with objects and
* provides a mechanism for mapping a name to an object. Since all
diff --git a/src/H5Gname.c b/src/H5Gname.c
index 2465f01..c139a4e 100644
--- a/src/H5Gname.c
+++ b/src/H5Gname.c
@@ -468,11 +468,10 @@ H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth)
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cached)
+herr_t
+H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name_len, hbool_t *cached)
{
- ssize_t len = 0; /* Length of object's name */
- ssize_t ret_value = -1; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -481,14 +480,20 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cac
/* If the user path is available and it's not "hidden", use it */
if (loc->path->user_path_r != NULL && loc->path->obj_hidden == 0) {
+ size_t len; /* Length of object's name */
+
len = H5RS_len(loc->path->user_path_r);
if (name) {
- HDstrncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((size_t)(len + 1), size));
- if ((size_t)len >= size)
+ HDstrncpy(name, H5RS_get_str(loc->path->user_path_r), MIN((len + 1), size));
+ if (len >= size)
name[size - 1] = '\0';
} /* end if */
+ /* Set name length, if requested */
+ if (name_len)
+ *name_len = len;
+
/* Indicate that the name is cached, if requested */
/* (Currently only used for testing - QAK, 2010/07/26) */
if (cached)
@@ -496,7 +501,7 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cac
} /* end if */
else if (!loc->path->obj_hidden) {
/* Search for name of object */
- if ((len = H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size)) < 0)
+ if (H5G_get_name_by_addr(loc->oloc->file, loc->oloc, name, size, name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't determine name")
/* Indicate that the name is _not_ cached, if requested */
@@ -505,9 +510,6 @@ H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cac
*cached = FALSE;
} /* end else */
- /* Set return value */
- ret_value = len;
-
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5G_get_name() */
@@ -1152,28 +1154,29 @@ done:
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
+herr_t
+H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size, size_t *name_len)
{
- H5G_gnba_iter_t udata; /* User data for iteration */
- H5G_loc_t root_loc; /* Root group's location */
- hbool_t found_obj = FALSE; /* If we found the object */
- herr_t status; /* Status from iteration */
- ssize_t ret_value = -1; /* Return value */
+ H5G_gnba_iter_t udata; /* User data for iteration */
+ size_t len; /* Length of path name */
+ H5G_loc_t root_loc; /* Root group's location */
+ hbool_t found_obj = FALSE; /* If we found the object */
+ herr_t status; /* Status from iteration */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Portably clear udata struct (before FUNC_ENTER) */
HDmemset(&udata, 0, sizeof(udata));
- FUNC_ENTER_NOAPI((-1))
+ FUNC_ENTER_NOAPI(FAIL)
/* Construct a group location for root group of the file */
if (H5G_root_loc(f, &root_loc) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_CANTGET, (-1), "can't get root group's location")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get root group's location")
/* Check for root group being the object looked for */
if (root_loc.oloc->addr == loc->addr && root_loc.oloc->file == loc->file) {
if (NULL == (udata.path = H5MM_strdup("")))
- HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, (-1), "can't duplicate path string")
+ HGOTO_ERROR(H5E_SYM, H5E_CANTALLOC, FAIL, "can't duplicate path string")
found_obj = TRUE;
} /* end if */
else {
@@ -1184,7 +1187,7 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
/* Visit all the links in the file */
if ((status = H5G_visit(&root_loc, "/", H5_INDEX_NAME, H5_ITER_NATIVE, H5G__get_name_by_addr_cb,
&udata)) < 0)
- HGOTO_ERROR(H5E_SYM, H5E_BADITER, (-1), "group traversal failed while looking for object name")
+ HGOTO_ERROR(H5E_SYM, H5E_BADITER, FAIL, "group traversal failed while looking for object name")
else if (status > 0)
found_obj = TRUE;
} /* end else */
@@ -1192,7 +1195,7 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
/* Check for finding the object */
if (found_obj) {
/* Set the length of the full path */
- ret_value = (ssize_t)(HDstrlen(udata.path) + 1); /* Length of path + 1 (for "/") */
+ len = HDstrlen(udata.path) + 1; /* Length of path + 1 (for "/") */
/* If there's a buffer provided, copy into it, up to the limit of its size */
if (name) {
@@ -1202,12 +1205,16 @@ H5G_get_name_by_addr(H5F_t *f, const H5O_loc_t *loc, char *name, size_t size)
/* Append the rest of the path */
/* (less one character, for the initial path separator) */
HDstrncat(name, udata.path, (size - 2));
- if ((size_t)ret_value >= size)
+ if (len >= size)
name[size - 1] = '\0';
} /* end if */
} /* end if */
else
- ret_value = 0;
+ len = 0;
+
+ /* Set path name length, if given */
+ if (name_len)
+ *name_len = len;
done:
/* Release resources */
diff --git a/src/H5Gobj.c b/src/H5Gobj.c
index 1ca6b14..66917c2 100644
--- a/src/H5Gobj.c
+++ b/src/H5Gobj.c
@@ -767,13 +767,13 @@ done:
*
*-------------------------------------------------------------------------
*/
-ssize_t
+herr_t
H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- char *name, size_t size)
+ char *name, size_t name_size, size_t *name_len)
{
- H5O_linfo_t linfo; /* Link info message */
- htri_t linfo_exists; /* Whether the link info message exists */
- ssize_t ret_value = -1; /* Return value */
+ H5O_linfo_t linfo; /* Link info message */
+ htri_t linfo_exists; /* Whether the link info message exists */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI_TAG(oloc->addr, FAIL)
@@ -785,22 +785,21 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_orde
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't check for link info message")
if (linfo_exists) {
/* Check for creation order tracking, if creation order index lookup requested */
- if (idx_type == H5_INDEX_CRT_ORDER) {
+ if (idx_type == H5_INDEX_CRT_ORDER)
/* Check if creation order is tracked */
if (!linfo.track_corder)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "creation order not tracked for links in group")
- } /* end if */
/* Check for dense link storage */
if (H5F_addr_defined(linfo.fheap_addr)) {
/* Get the object's name from the dense link storage */
- if ((ret_value = H5G__dense_get_name_by_idx(oloc->file, &linfo, idx_type, order, n, name, size)) <
- 0)
+ if (H5G__dense_get_name_by_idx(oloc->file, &linfo, idx_type, order, n, name, name_size,
+ name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
} /* end if */
else {
/* Get the object's name from the link messages */
- if ((ret_value = H5G__compact_get_name_by_idx(oloc, &linfo, idx_type, order, n, name, size)) < 0)
+ if (H5G__compact_get_name_by_idx(oloc, &linfo, idx_type, order, n, name, name_size, name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
} /* end else */
} /* end if */
@@ -810,7 +809,7 @@ H5G_obj_get_name_by_idx(const H5O_loc_t *oloc, H5_index_t idx_type, H5_iter_orde
HGOTO_ERROR(H5E_SYM, H5E_BADVALUE, FAIL, "no creation order index to query")
/* Get the object's name from the symbol table */
- if ((ret_value = H5G__stab_get_name_by_idx(oloc, order, n, name, size)) < 0)
+ if (H5G__stab_get_name_by_idx(oloc, order, n, name, name_size, name_len) < 0)
HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "can't locate name")
} /* end else */
diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h
index a5efd48..d108b03 100644
--- a/src/H5Gpkg.h
+++ b/src/H5Gpkg.h
@@ -358,14 +358,14 @@ H5_DLL herr_t H5G__stab_iterate(const H5O_loc_t *oloc, H5_iter_order_t order, hs
H5G_lib_iterate_t op, void *op_data);
H5_DLL herr_t H5G__stab_count(const struct H5O_loc_t *oloc, hsize_t *num_objs);
H5_DLL herr_t H5G__stab_bh_size(H5F_t *f, const H5O_stab_t *stab, H5_ih_info_t *bh_info);
-H5_DLL ssize_t H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name,
- size_t size);
-H5_DLL herr_t H5G__stab_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
-H5_DLL herr_t H5G__stab_remove_by_idx(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5O_link_t *lnk);
-H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
- H5O_link_t *lnk);
+H5_DLL herr_t H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name,
+ size_t name_size, size_t *name_len);
+H5_DLL herr_t H5G__stab_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
+H5_DLL herr_t H5G__stab_remove_by_idx(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G__stab_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found, H5O_link_t *lnk);
+H5_DLL herr_t H5G__stab_lookup_by_idx(const H5O_loc_t *grp_oloc, H5_iter_order_t order, hsize_t n,
+ H5O_link_t *lnk);
#ifndef H5_STRICT_FORMAT_CHECKS
H5_DLL herr_t H5G__stab_valid(H5O_loc_t *grp_oloc, H5O_stab_t *alt_stab);
#endif /* H5_STRICT_FORMAT_CHECKS */
@@ -405,41 +405,42 @@ H5_DLL herr_t H5G__link_release_table(H5G_link_table_t *ltable);
H5_DLL herr_t H5G__link_name_replace(H5F_t *file, H5RS_str_t *grp_full_path_r, const H5O_link_t *lnk);
/* Functions that understand "compact" link storage */
-H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk);
-H5_DLL ssize_t H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
- char *name, size_t size);
-H5_DLL herr_t H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
-H5_DLL herr_t H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
- H5RS_str_t *grp_full_path_r, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
- H5G_lib_iterate_t op, void *op_data);
-H5_DLL herr_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found,
- H5O_link_t *lnk);
+H5_DLL herr_t H5G__compact_insert(const H5O_loc_t *grp_oloc, H5O_link_t *obj_lnk);
+H5_DLL herr_t H5G__compact_get_name_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t idx,
+ char *name, size_t name_size, size_t *name_len);
+H5_DLL herr_t H5G__compact_remove(const H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
+H5_DLL herr_t H5G__compact_remove_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo,
+ H5RS_str_t *grp_full_path_r, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G__compact_iterate(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk,
+ H5G_lib_iterate_t op, void *op_data);
+H5_DLL herr_t H5G__compact_lookup(const H5O_loc_t *grp_oloc, const char *name, hbool_t *found,
+ H5O_link_t *lnk);
H5_DLL herr_t H5G__compact_lookup_by_idx(const H5O_loc_t *oloc, const H5O_linfo_t *linfo, H5_index_t idx_type,
H5_iter_order_t order, hsize_t n, H5O_link_t *lnk);
/* Functions that understand "dense" link storage */
-H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, H5G_link_table_t *ltable);
-H5_DLL herr_t H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline);
-H5_DLL herr_t H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk);
-H5_DLL herr_t H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, hbool_t *found,
- H5O_link_t *lnk);
-H5_DLL herr_t H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5O_link_t *lnk);
-H5_DLL herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
- void *op_data);
-H5_DLL ssize_t H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, char *name, size_t size);
-H5_DLL herr_t H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
- const char *name);
-H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link);
+H5_DLL herr_t H5G__dense_build_table(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, H5G_link_table_t *ltable);
+H5_DLL herr_t H5G__dense_create(H5F_t *f, H5O_linfo_t *linfo, const H5O_pline_t *pline);
+H5_DLL herr_t H5G__dense_insert(H5F_t *f, const H5O_linfo_t *linfo, const H5O_link_t *lnk);
+H5_DLL herr_t H5G__dense_lookup(H5F_t *f, const H5O_linfo_t *linfo, const char *name, hbool_t *found,
+ H5O_link_t *lnk);
+H5_DLL herr_t H5G__dense_lookup_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5O_link_t *lnk);
+H5_DLL herr_t H5G__dense_iterate(H5F_t *f, const H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t skip, hsize_t *last_lnk, H5G_lib_iterate_t op,
+ void *op_data);
+H5_DLL herr_t H5G__dense_get_name_by_idx(H5F_t *f, H5O_linfo_t *linfo, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, char *name, size_t name_size,
+ size_t *name_len);
+H5_DLL herr_t H5G__dense_remove(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
+ const char *name);
+H5_DLL herr_t H5G__dense_remove_by_idx(H5F_t *f, const H5O_linfo_t *linfo, H5RS_str_t *grp_full_path_r,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G__dense_delete(H5F_t *f, H5O_linfo_t *linfo, hbool_t adj_link);
/* Functions that understand group objects */
H5_DLL herr_t H5G__obj_create(H5F_t *f, H5G_obj_create_t *gcrt_info, H5O_loc_t *oloc /*out*/);
diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h
index 409d790..4cf4623 100644
--- a/src/H5Gprivate.h
+++ b/src/H5Gprivate.h
@@ -144,7 +144,7 @@ struct H5O_link_t;
* The "location" of an object in a group hierarchy. This points to an object
* location and a group hierarchy path for the object.
*/
-typedef struct {
+typedef struct H5G_loc_t {
struct H5O_loc_t *oloc; /* Object header location */
H5G_name_t * path; /* Group hierarchy path */
} H5G_loc_t;
@@ -227,16 +227,17 @@ H5_DLL herr_t H5G_link_to_info(const struct H5O_loc_t *link_loc, const struct H5
/*
* Functions that understand group objects
*/
-H5_DLL herr_t H5G_obj_insert(const struct H5O_loc_t *grp_oloc, const char *name, struct H5O_link_t *obj_lnk,
- hbool_t adj_link, H5O_type_t obj_type, const void *crt_info);
-H5_DLL ssize_t H5G_obj_get_name_by_idx(const struct H5O_loc_t *oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, char *name, size_t size);
-H5_DLL herr_t H5G_obj_remove(const struct H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
-H5_DLL herr_t H5G_obj_remove_by_idx(const struct H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r,
- H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5G_obj_lookup_by_idx(const struct H5O_loc_t *grp_oloc, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, struct H5O_link_t *lnk);
-H5_DLL hid_t H5G_get_create_plist(const H5G_t *grp);
+H5_DLL herr_t H5G_obj_insert(const struct H5O_loc_t *grp_oloc, const char *name, struct H5O_link_t *obj_lnk,
+ hbool_t adj_link, H5O_type_t obj_type, const void *crt_info);
+H5_DLL herr_t H5G_obj_get_name_by_idx(const struct H5O_loc_t *oloc, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, char *name, size_t name_size,
+ size_t *name_len);
+H5_DLL herr_t H5G_obj_remove(const struct H5O_loc_t *oloc, H5RS_str_t *grp_full_path_r, const char *name);
+H5_DLL herr_t H5G_obj_remove_by_idx(const struct H5O_loc_t *grp_oloc, H5RS_str_t *grp_full_path_r,
+ H5_index_t idx_type, H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5G_obj_lookup_by_idx(const struct H5O_loc_t *grp_oloc, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, struct H5O_link_t *lnk);
+H5_DLL hid_t H5G_get_create_plist(const H5G_t *grp);
/*
* These functions operate on symbol table nodes.
@@ -253,35 +254,37 @@ H5_DLL herr_t H5G_ent_decode(const H5F_t *f, const uint8_t **pp, H5G_entry_t *en
/*
* These functions operate on group hierarchy names.
*/
-H5_DLL herr_t H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name);
-H5_DLL herr_t H5G_name_replace(const struct H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
- H5RS_str_t *src_full_path_r, H5F_t *dst_file, H5RS_str_t *dst_full_path_r);
-H5_DLL herr_t H5G_name_reset(H5G_name_t *name);
-H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth);
-H5_DLL herr_t H5G_name_free(H5G_name_t *name);
-H5_DLL ssize_t H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, hbool_t *cached);
-H5_DLL ssize_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, char *name, size_t size);
+H5_DLL herr_t H5G_name_set(const H5G_name_t *loc, H5G_name_t *obj, const char *name);
+H5_DLL herr_t H5G_name_replace(const struct H5O_link_t *lnk, H5G_names_op_t op, H5F_t *src_file,
+ H5RS_str_t *src_full_path_r, H5F_t *dst_file, H5RS_str_t *dst_full_path_r);
+H5_DLL herr_t H5G_name_reset(H5G_name_t *name);
+H5_DLL herr_t H5G_name_copy(H5G_name_t *dst, const H5G_name_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5G_name_free(H5G_name_t *name);
+H5_DLL herr_t H5G_get_name(const H5G_loc_t *loc, char *name /*out*/, size_t size, size_t *name_len,
+ hbool_t *cached);
+H5_DLL herr_t H5G_get_name_by_addr(H5F_t *f, const struct H5O_loc_t *loc, char *name, size_t size,
+ size_t *name_len);
H5_DLL H5RS_str_t *H5G_build_fullpath_refstr_str(H5RS_str_t *path_r, const char *name);
/*
* These functions operate on group "locations"
*/
-H5_DLL herr_t H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc);
-H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc);
-H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth);
-H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc /*out*/);
-H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5G_loc_t *obj_loc /*out*/);
-H5_DLL htri_t H5G_loc_exists(const H5G_loc_t *loc, const char *name);
-H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo /*out*/,
- unsigned fields);
-H5_DLL herr_t H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *oinfo /*out*/,
- unsigned fields);
-H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment);
-H5_DLL ssize_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/,
- size_t bufsize);
-H5_DLL herr_t H5G_loc_reset(H5G_loc_t *loc);
-H5_DLL herr_t H5G_loc_free(H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc(hid_t loc_id, H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_copy(H5G_loc_t *dst, const H5G_loc_t *src, H5_copy_depth_t depth);
+H5_DLL herr_t H5G_loc_find(const H5G_loc_t *loc, const char *name, H5G_loc_t *obj_loc /*out*/);
+H5_DLL herr_t H5G_loc_find_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5G_loc_t *obj_loc /*out*/);
+H5_DLL herr_t H5G_loc_exists(const H5G_loc_t *loc, const char *name, hbool_t *exists);
+H5_DLL herr_t H5G_loc_info(const H5G_loc_t *loc, const char *name, H5O_info2_t *oinfo /*out*/,
+ unsigned fields);
+H5_DLL herr_t H5G_loc_native_info(const H5G_loc_t *loc, const char *name, H5O_native_info_t *oinfo /*out*/,
+ unsigned fields);
+H5_DLL herr_t H5G_loc_set_comment(const H5G_loc_t *loc, const char *name, const char *comment);
+H5_DLL herr_t H5G_loc_get_comment(const H5G_loc_t *loc, const char *name, char *comment /*out*/,
+ size_t bufsize, size_t *comment_len);
+H5_DLL herr_t H5G_loc_reset(H5G_loc_t *loc);
+H5_DLL herr_t H5G_loc_free(H5G_loc_t *loc);
/*
* These functions operate on the root group
diff --git a/src/H5Gpublic.h b/src/H5Gpublic.h
index b009d41..d9c29f6 100644
--- a/src/H5Gpublic.h
+++ b/src/H5Gpublic.h
@@ -467,6 +467,7 @@ H5_DLL herr_t H5Gclose(hid_t group_id);
H5_DLL herr_t H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id,
hid_t es_id);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -488,6 +489,7 @@ H5_DLL herr_t H5Gclose_async(const char *app_file, const char *app_func, unsigne
#define H5Gget_info_by_idx_async_wrap H5_NO_EXPAND(H5Gget_info_by_idx_async)
#define H5Gclose_async_wrap H5_NO_EXPAND(H5Gclose_async)
#endif /* H5G_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5Gstab.c b/src/H5Gstab.c
index bf4b417..ca74aa5 100644
--- a/src/H5Gstab.c
+++ b/src/H5Gstab.c
@@ -705,22 +705,22 @@ done:
*
* Purpose: Returns the name of objects in the group by giving index.
*
- * Return: Success: Non-negative, length of name
- * Failure: Negative
+ * Return: Non-negative on success/Negative on failure
*
* Programmer: Raymond Lu
* Nov 20, 2002
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name, size_t size)
+herr_t
+H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t n, char *name,
+ size_t name_size, size_t *name_len)
{
- H5HL_t * heap = NULL; /* Pointer to local heap */
- H5O_stab_t stab; /* Info about local heap & B-tree */
- H5G_bt_it_gnbi_t udata; /* Iteration information */
- hbool_t udata_valid = FALSE; /* Whether iteration information is valid */
- ssize_t ret_value = -1; /* Return value */
+ H5HL_t * heap = NULL; /* Pointer to local heap */
+ H5O_stab_t stab; /* Info about local heap & B-tree */
+ H5G_bt_it_gnbi_t udata; /* Iteration information */
+ hbool_t udata_valid = FALSE; /* Whether iteration information is valid */
+ herr_t ret_value = SUCCEED; /* Return value */
/* Portably clear udata struct (before FUNC_ENTER) */
HDmemset(&udata, 0, sizeof(udata));
@@ -767,13 +767,13 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "index out of bound")
/* Get the length of the name */
- ret_value = (ssize_t)HDstrlen(udata.name);
+ *name_len = HDstrlen(udata.name);
/* Copy the name into the user's buffer, if given */
if (name) {
- HDstrncpy(name, udata.name, MIN((size_t)(ret_value + 1), size));
- if ((size_t)ret_value >= size)
- name[size - 1] = '\0';
+ HDstrncpy(name, udata.name, MIN((*name_len + 1), name_size));
+ if (*name_len >= name_size)
+ name[name_size - 1] = '\0';
} /* end if */
done:
diff --git a/src/H5Gtest.c b/src/H5Gtest.c
index 9f0dca2..7ae41ed 100644
--- a/src/H5Gtest.c
+++ b/src/H5Gtest.c
@@ -616,14 +616,14 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign
/* Retrieve a copy of the user path and put it into the buffer */
if (obj_path->user_path_r) {
- ssize_t len = H5RS_len(obj_path->user_path_r);
+ size_t len = H5RS_len(obj_path->user_path_r);
/* Set the user path, if given */
if (user_path)
- HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (size_t)(len + 1));
+ HDstrncpy(user_path, H5RS_get_str(obj_path->user_path_r), (len + 1));
/* Set the length of the path */
- *user_path_len = (size_t)len;
+ *user_path_len = len;
/* Set the user path hidden flag */
*obj_hidden = obj_path->obj_hidden;
diff --git a/src/H5HF.c b/src/H5HF.c
index 1f4cc26..6c6b101 100644
--- a/src/H5HF.c
+++ b/src/H5HF.c
@@ -117,8 +117,14 @@ H5HF__op_write(const void *obj, size_t obj_len, void *op_data)
{
FUNC_ENTER_PACKAGE_NOERR
- /* Perform "write", using memcpy() */
- H5MM_memcpy((void *)obj, op_data, obj_len); /* Casting away const OK -QAK */
+ /* Perform "write", using memcpy()
+ *
+ * We cast away const here because no obj pointer that was originally
+ * const should ever arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ H5MM_memcpy((void *)obj, op_data, obj_len);
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5HF__op_write() */
@@ -350,10 +356,15 @@ H5HF_insert(H5HF_t *fh, size_t size, const void *obj, void *id /*out*/)
/* Check for 'huge' object */
if (size > hdr->max_man_size) {
- /* Store 'huge' object in heap */
- /* (Casting away const OK - QAK) */
+ /* Store 'huge' object in heap
+ *
+ * Although not ideal, we can quiet the const warning here becuase no
+ * obj pointer that was originally const should ever arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5HF__huge_insert(hdr, size, (void *)obj, id) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTINSERT, FAIL, "can't store 'huge' object in fractal heap")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
/* Check for 'tiny' object */
else if (size <= hdr->tiny_max_len) {
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index ea5e730..654fa36 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -1658,9 +1658,15 @@ H5HF__cache_dblock_verify_chksum(const void *_image, size_t len, void *_udata)
/* Update info about direct block */
udata->decompressed = TRUE;
len = nbytes;
- } /* end if */
- else
- read_buf = (void *)image; /* Casting away const OK - QAK */
+ }
+ else {
+ /* If the data are unfiltered, we just point to the image, which we
+ * never modify. Casting away const is okay here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ read_buf = (void *)image;
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ }
/* Decode checksum */
chk_size = (size_t)(H5HF_MAN_ABS_DIRECT_OVERHEAD(hdr) - H5HF_SIZEOF_CHKSUM);
diff --git a/src/H5HFman.c b/src/H5HFman.c
index 427be00..a362d99 100644
--- a/src/H5HFman.c
+++ b/src/H5HFman.c
@@ -487,10 +487,16 @@ H5HF__man_write(H5HF_hdr_t *hdr, const uint8_t *id, const void *obj)
HDassert(id);
HDassert(obj);
- /* Call the internal 'op' routine routine */
- /* (Casting away const OK - QAK) */
+ /* Call the internal 'op' routine routine
+ *
+ * In this case, the callback operation needs to modify the obj buffer that
+ * was passed in as const. We quiet the warning here because an obj pointer
+ * that was originally const should *never* arrive here.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (H5HF__man_op_real(hdr, id, H5HF__op_write, (void *)obj, H5HF_OP_MODIFY) < 0)
HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "unable to operate on heap object")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5HGprivate.h b/src/H5HGprivate.h
index d8e6b46..5deae88 100644
--- a/src/H5HGprivate.h
+++ b/src/H5HGprivate.h
@@ -50,7 +50,7 @@ typedef struct H5HG_heap_t H5HG_heap_t;
/* Size of encoded global heap ID */
/* (size of file address + 32-bit integer) */
-#define H5HG_HEAP_ID_SIZE(F) ((size_t)H5F_SIZEOF_ADDR(F) + H5_SIZEOF_UINT32_T)
+#define H5HG_HEAP_ID_SIZE(F) ((size_t)H5F_SIZEOF_ADDR(F) + sizeof(uint32_t))
/* Main global heap routines */
H5_DLL herr_t H5HG_insert(H5F_t *f, size_t size, const void *obj, H5HG_t *hobj /*out*/);
diff --git a/src/H5I.c b/src/H5I.c
index 1973354..954a86b 100644
--- a/src/H5I.c
+++ b/src/H5I.c
@@ -925,9 +925,11 @@ done:
ssize_t
H5Iget_name(hid_t id, char *name /*out*/, size_t size)
{
- H5VL_object_t * vol_obj = NULL; /* Object stored in ID */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object stored in ID */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ size_t obj_name_len = 0; /* Length of object's name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", id, name, size);
@@ -940,11 +942,19 @@ H5Iget_name(hid_t id, char *name /*out*/, size_t size)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_NAME;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.name_len = &obj_name_len;
+
/* Retrieve object's name */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value, name, size) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)obj_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Iget_name() */
diff --git a/src/H5Idbg.c b/src/H5Idbg.c
index 7b5eb5a..8bf8ecb 100644
--- a/src/H5Idbg.c
+++ b/src/H5Idbg.c
@@ -110,9 +110,9 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
case H5I_DATATYPE: {
const H5T_t *dt = (const H5T_t *)info->object;
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
object = (void *)H5T_get_actual_type((H5T_t *)dt); /* Casting away const OK - QAK */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
path = H5T_nameof((const H5T_t *)object);
break;
diff --git a/src/H5Iint.c b/src/H5Iint.c
index 164fafc..86a2810 100644
--- a/src/H5Iint.c
+++ b/src/H5Iint.c
@@ -391,7 +391,7 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
*/
if (udata->force || (info->count - (!udata->app_ref * info->app_count)) <= 1) {
/* Check if this is an un-realized future object */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (info->is_future) {
/* Discard the future object */
if ((info->discard_cb)((void *)info->object) < 0) {
@@ -437,7 +437,7 @@ H5I__mark_node(void *_info, void H5_ATTR_UNUSED *key, void *_udata)
mark = TRUE;
}
}
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Remove ID if requested */
if (mark) {
@@ -705,9 +705,9 @@ H5I_subst(hid_t id, const void *new_object)
HGOTO_ERROR(H5E_ID, H5E_NOTFOUND, NULL, "can't get ID ref count")
/* Get the old object pointer to return */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Set the new object pointer for the ID */
info->object = new_object;
@@ -739,9 +739,9 @@ H5I_object(hid_t id)
/* General lookup of the ID */
if (NULL != (info = H5I__find_id(id))) {
/* Get the object pointer to return */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -775,9 +775,9 @@ H5I_object_verify(hid_t id, H5I_type_t type)
/* Verify that the type of the ID is correct & lookup the ID */
if (type == H5I_TYPE(id) && NULL != (info = H5I__find_id(id))) {
/* Get the object pointer to return */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
}
FUNC_LEAVE_NOAPI(ret_value)
@@ -938,9 +938,9 @@ H5I__remove_common(H5I_type_info_t *type_info, hid_t id)
if (type_info->last_id_info == info)
type_info->last_id_info = NULL;
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
ret_value = (void *)info->object; /* (Casting away const OK -QAK) */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
if (!H5I_marking_g)
info = H5FL_FREE(H5I_id_info_t, info);
@@ -1040,7 +1040,7 @@ H5I__dec_ref(hid_t id, void **request)
/* Get the ID's type */
type_info = H5I_type_info_array_g[H5I_TYPE(id)];
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
/* (Casting away const OK -QAK) */
if (!type_info->cls->free_func || (type_info->cls->free_func)((void *)info->object, request) >= 0) {
/* Remove the node from the type */
@@ -1050,7 +1050,7 @@ H5I__dec_ref(hid_t id, void **request)
} /* end if */
else
ret_value = -1;
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
} /* end if */
else {
--(info->count);
@@ -1529,9 +1529,9 @@ H5I__iterate_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
/* The stored object pointer might be an H5VL_object_t, in which
* case we'll need to get the wrapped object struct (H5F_t *, etc.).
*/
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Invoke callback function */
cb_ret_val = (*udata->user_func)((void *)object, info->id, udata->user_udata);
@@ -1654,7 +1654,7 @@ H5I__find_id(hid_t id)
}
/* Check if this is a future ID */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (id_info && id_info->is_future) {
hid_t actual_id = H5I_INVALID_HID; /* ID for actual object */
void *future_object; /* Pointer to the future object */
@@ -1686,7 +1686,7 @@ H5I__find_id(hid_t id)
id_info->realize_cb = NULL;
id_info->discard_cb = NULL;
}
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Set return value */
ret_value = id_info;
@@ -1721,9 +1721,9 @@ H5I__find_id_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
HDassert(udata);
/* Get a pointer to the VOL connector's data */
- H5_GCC_DIAG_OFF("cast-qual")
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
object = H5I__unwrap((void *)info->object, type); /* Casting away const OK */
- H5_GCC_DIAG_ON("cast-qual")
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Check for a match */
if (object == udata->object) {
diff --git a/src/H5Imodule.h b/src/H5Imodule.h
index 8db31c8..08f8bb0 100644
--- a/src/H5Imodule.h
+++ b/src/H5Imodule.h
@@ -30,8 +30,85 @@
#define H5_MY_PKG_INIT NO
/**\defgroup H5I H5I
- * \brief Identifier Interface
- * \todo Describe concisely what the functions in this module are about.
+ *
+ * Use the functions in this module to manage identifiers defined by the HDF5
+ * library. See \ref H5IUD for user-defined identifiers and identifier
+ * types.
+ *
+ * HDF5 identifiers are usually created as a side-effect of creating HDF5
+ * entities such as groups, datasets, attributes, or property lists.
+ *
+ * Identifiers defined by the HDF5 library can be used to retrieve information
+ * such as path names and reference counts, and their validity can be checked.
+ *
+ * Identifiers can be updated by manipulating their reference counts.
+ *
+ * Unused identifiers should be reclaimed by closing the associated item, e.g.,
+ * HDF5 object, or decrementing the reference count to 0.
+ *
+ * \note Identifiers (of type \ref hid_t) are run-time auxiliaries and
+ * not persisted in the file.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \defgroup H5IUD User-defined ID Types
+ * \ingroup H5I
+ *
+ * The \ref H5I module contains functions to define new identifier types.
+ * For convenience, handles of type \ref hid_t can then be associated with the
+ * new identifier types and user objects.
+ *
+ * New identifier types can be created by registering a new identifier type
+ * with the HDF5 library. Once a new identifier type has bee registered,
+ * it can be used to generate identifiers for user objects.
+ *
+ * User-defined identifier types can be searched and iterated.
+ *
+ * Like library-defined identifiers, user-defined identifiers \Emph{and}
+ * identifier types are reference counted, and the reference counts can be
+ * manipulated accordingly.
+ *
+ * User-defined identifiers no longer in use should be deleted or reclaimed,
+ * and identifier types should be destroyed if they are no longer required.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c create_ud
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c read_ud
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5I_examples.c update_ud
+ * </td>
+ * <td>
+ * \snippet{lineno} H5I_examples.c delete_ud
+ * </td>
+ * </tr>
+ * </table>
+ *
*/
#endif /* H5Imodule_H */
diff --git a/src/H5Ipublic.h b/src/H5Ipublic.h
index a5f830b..8d4dbf8 100644
--- a/src/H5Ipublic.h
+++ b/src/H5Ipublic.h
@@ -106,7 +106,7 @@ extern "C" {
/* Public API functions */
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Registers an object under a type and returns an ID for it
*
@@ -128,7 +128,7 @@ extern "C" {
*/
H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Returns the object referenced by an ID
*
@@ -151,7 +151,7 @@ H5_DLL hid_t H5Iregister(H5I_type_t type, const void *object);
*/
H5_DLL void *H5Iobject_verify(hid_t id, H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Removes an ID from its type
*
@@ -190,12 +190,7 @@ H5_DLL void *H5Iremove_verify(hid_t id, H5I_type_t type);
* \return Returns the object type if successful; otherwise #H5I_BADID.
*
* \details H5Iget_type() retrieves the type of the object identified by
- * \p id.
- *
- * Valid types returned by the function are:
- * \id_types
- *
- * If no valid type can be determined or the identifier submitted is
+ * \p id. If no valid type can be determined or the identifier submitted is
* invalid, the function returns #H5I_BADID.
*
* This function is of particular use in determining the type of
@@ -391,7 +386,7 @@ H5_DLL int H5Idec_ref(hid_t id);
*/
H5_DLL int H5Iget_ref(hid_t id);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Creates and returns a new ID type
*
@@ -423,7 +418,7 @@ H5_DLL int H5Iget_ref(hid_t id);
*/
H5_DLL H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Deletes all identifiers of the given type
*
@@ -447,7 +442,7 @@ H5_DLL H5I_type_t H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free
*/
H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Removes an identifier type and all identifiers within that type
*
@@ -470,7 +465,7 @@ H5_DLL herr_t H5Iclear_type(H5I_type_t type, hbool_t force);
*/
H5_DLL herr_t H5Idestroy_type(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Increments the reference count on an ID type
*
@@ -489,7 +484,7 @@ H5_DLL herr_t H5Idestroy_type(H5I_type_t type);
*/
H5_DLL int H5Iinc_type_ref(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Decrements the reference count on an identifier type
*
@@ -509,7 +504,7 @@ H5_DLL int H5Iinc_type_ref(H5I_type_t type);
*/
H5_DLL int H5Idec_type_ref(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Retrieves the reference count on an ID type
*
@@ -528,7 +523,7 @@ H5_DLL int H5Idec_type_ref(H5I_type_t type);
*/
H5_DLL int H5Iget_type_ref(H5I_type_t type);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Finds the memory referred to by an ID within the given ID type such
* that some criterion is satisfied
@@ -569,7 +564,7 @@ H5_DLL int H5Iget_type_ref(H5I_type_t type);
*/
H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Calls a callback for each member of the identifier type specified
*
@@ -598,7 +593,7 @@ H5_DLL void *H5Isearch(H5I_type_t type, H5I_search_func_t func, void *key);
*/
H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Returns the number of identifiers in a given identifier type
*
@@ -618,7 +613,7 @@ H5_DLL herr_t H5Iiterate(H5I_type_t type, H5I_iterate_func_t op, void *op_data);
*/
H5_DLL herr_t H5Inmembers(H5I_type_t type, hsize_t *num_members);
/**
- * \ingroup H5I
+ * \ingroup H5IUD
*
* \brief Determines whether an identifier type is registered
*
diff --git a/src/H5Itest.c b/src/H5Itest.c
index 71ef3f8..80738a9 100644
--- a/src/H5Itest.c
+++ b/src/H5Itest.c
@@ -71,6 +71,7 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached)
H5G_loc_t loc; /* Object location */
hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ size_t name_len = 0; /* Length of name */
ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_PACKAGE
@@ -86,7 +87,7 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached)
/* Set wrapper info in API context */
if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_ID, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ HGOTO_ERROR(H5E_ID, H5E_CANTSET, (-1), "can't set VOL wrapper info")
vol_wrapper_set = TRUE;
/* Get object location */
@@ -94,13 +95,16 @@ H5I__get_name_test(hid_t id, char *name /*out*/, size_t size, hbool_t *cached)
HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object location")
/* Call internal group routine to retrieve object's name */
- if ((ret_value = H5G_get_name(&loc, name, size, cached)) < 0)
+ if (H5G_get_name(&loc, name, size, &name_len, cached) < 0)
HGOTO_ERROR(H5E_ID, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)name_len;
+
done:
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_ID, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+ HDONE_ERROR(H5E_ID, H5E_CANTRESET, (-1), "can't reset VOL wrapper info")
if (api_ctx_pushed && H5CX_pop(FALSE) < 0)
HDONE_ERROR(H5E_SYM, H5E_CANTRESET, (-1), "can't reset API context")
diff --git a/src/H5L.c b/src/H5L.c
index a30c4da..065cc5c 100644
--- a/src/H5L.c
+++ b/src/H5L.c
@@ -148,14 +148,28 @@ H5Lmove(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (vol_obj1 && vol_obj2) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary source VOL object */
- tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL);
- tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector);
+ if (vol_obj1) {
+ tmp_vol_obj.connector = vol_obj1->connector;
+ tmp_vol_obj.data = vol_obj1->data;
+ } /* end if */
+ else {
+ HDassert(vol_obj2);
+
+ tmp_vol_obj.connector = vol_obj2->connector;
+ tmp_vol_obj.data = NULL;
+ } /* end else */
/* Move the link */
if (H5VL_link_move(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id,
@@ -238,14 +252,28 @@ H5Lcopy(hid_t src_loc_id, const char *src_name, hid_t dst_loc_id, const char *ds
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (vol_obj1 && vol_obj2) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary source VOL object */
- tmp_vol_obj.data = (vol_obj1 ? vol_obj1->data : NULL);
- tmp_vol_obj.connector = (vol_obj1 ? vol_obj1->connector : vol_obj2->connector);
+ if (vol_obj1) {
+ tmp_vol_obj.connector = vol_obj1->connector;
+ tmp_vol_obj.data = vol_obj1->data;
+ } /* end if */
+ else {
+ HDassert(vol_obj2);
+
+ tmp_vol_obj.connector = vol_obj2->connector;
+ tmp_vol_obj.data = NULL;
+ } /* end else */
/* Copy the link */
if (H5VL_link_copy(&tmp_vol_obj, &loc_params1, vol_obj2, &loc_params2, lcpl_id, lapl_id,
@@ -272,8 +300,9 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -286,6 +315,7 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "link_target parameter cannot be an empty string")
if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
+ /* link_name is verified in H5VL_setup_name_args() */
/* Get the link creation property list */
if (H5P_DEFAULT == lcpl_id)
@@ -298,15 +328,17 @@ H5L__create_soft_api_common(const char *link_target, hid_t link_loc_id, const ch
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, link_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* link_name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(link_loc_id, link_name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) <
- 0)
+ if (H5VL_setup_name_args(link_loc_id, link_name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_SOFT;
+ vol_cb_args.args.soft.target = link_target;
+
/* Create the link */
- if (H5VL_link_create(H5VL_LINK_CREATE_SOFT, *vol_obj_ptr, &loc_params, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, token_ptr, link_target) < 0)
+ if (H5VL_link_create(&vol_cb_args, *vol_obj_ptr, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT,
+ token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create soft link")
done:
@@ -401,31 +433,31 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t new_loc_id, const char *new_name,
+H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t link_loc_id, const char *link_name,
hid_t lcpl_id, hid_t lapl_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr)
{
- H5VL_object_t * vol_obj1 = NULL; /* Object of cur_loc_id */
- H5VL_object_t * vol_obj2 = NULL; /* Object of new_loc_id */
+ H5VL_object_t * curr_vol_obj = NULL; /* Object of cur_loc_id */
+ H5VL_object_t * link_vol_obj = NULL; /* Object of link_loc_id */
H5VL_object_t tmp_vol_obj; /* Temporary object */
H5VL_object_t * tmp_vol_obj_ptr = &tmp_vol_obj; /* Ptr to temporary object */
H5VL_object_t **tmp_vol_obj_ptr_ptr =
(_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj_ptr); /* Ptr to ptr to temporary object */
- H5VL_loc_params_t loc_params1; /* Location parameters for cur_loc_id object access */
- H5VL_loc_params_t loc_params2; /* Location parameters for new_loc_id object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t link_loc_params; /* Location parameters for link_loc_id object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Check arguments */
- if (cur_loc_id == H5L_SAME_LOC && new_loc_id == H5L_SAME_LOC)
+ if (cur_loc_id == H5L_SAME_LOC && link_loc_id == H5L_SAME_LOC)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "source and destination should not be both H5L_SAME_LOC")
if (!cur_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be NULL")
if (!*cur_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "cur_name parameter cannot be an empty string")
- if (!new_name)
+ if (!link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be NULL")
- if (!*new_name)
+ if (!*link_name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "new_name parameter cannot be an empty string")
if (lcpl_id != H5P_DEFAULT && (TRUE != H5P_isa_class(lcpl_id, H5P_LINK_CREATE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a link creation property list")
@@ -441,40 +473,59 @@ H5L__create_hard_api_common(hid_t cur_loc_id, const char *cur_name, hid_t new_lo
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, cur_loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
- /* Set up current & new location structs */
- 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 = lapl_id;
-
- 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 = lapl_id;
+ /* Set up new location struct */
+ link_loc_params.type = H5VL_OBJECT_BY_NAME;
+ link_loc_params.obj_type = H5I_get_type(link_loc_id);
+ link_loc_params.loc_data.loc_by_name.name = link_name;
+ link_loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
if (H5L_SAME_LOC != cur_loc_id)
/* Get the current location object */
- if (NULL == (vol_obj1 = (H5VL_object_t *)H5VL_vol_object(cur_loc_id)))
+ if (NULL == (curr_vol_obj = (H5VL_object_t *)H5VL_vol_object(cur_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- if (H5L_SAME_LOC != new_loc_id)
+ if (H5L_SAME_LOC != link_loc_id)
/* Get the new location object */
- if (NULL == (vol_obj2 = (H5VL_object_t *)H5VL_vol_object(new_loc_id)))
+ if (NULL == (link_vol_obj = (H5VL_object_t *)H5VL_vol_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (curr_vol_obj && link_vol_obj) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, curr_vol_obj->connector->cls,
+ link_vol_obj->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary VOL object */
- (*tmp_vol_obj_ptr_ptr)->data = (vol_obj2 ? (vol_obj2->data) : NULL);
- (*tmp_vol_obj_ptr_ptr)->connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
+ if (curr_vol_obj)
+ (*tmp_vol_obj_ptr_ptr)->connector = curr_vol_obj->connector;
+ else {
+ HDassert(link_vol_obj);
+
+ (*tmp_vol_obj_ptr_ptr)->connector = link_vol_obj->connector;
+ } /* end else */
+ if (link_vol_obj)
+ (*tmp_vol_obj_ptr_ptr)->data = link_vol_obj->data;
+ else
+ (*tmp_vol_obj_ptr_ptr)->data = NULL;
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_HARD;
+ vol_cb_args.args.hard.curr_obj = (curr_vol_obj ? curr_vol_obj->data : NULL);
+ vol_cb_args.args.hard.curr_loc_params.type = H5VL_OBJECT_BY_NAME;
+ vol_cb_args.args.hard.curr_loc_params.obj_type =
+ (H5L_SAME_LOC != cur_loc_id ? H5I_get_type(cur_loc_id) : H5I_BADID);
+ 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 = lapl_id;
/* Create the link */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, *tmp_vol_obj_ptr_ptr, &loc_params2, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, token_ptr, (vol_obj1 ? vol_obj1->data : NULL),
- &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, *tmp_vol_obj_ptr_ptr, &link_loc_params, lcpl_id, lapl_id,
+ H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create hard link")
done:
@@ -534,12 +585,11 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li
const char *cur_name, hid_t new_loc_id, const char *new_name, hid_t lcpl_id,
hid_t lapl_id, hid_t es_id)
{
- H5VL_object_t vol_obj; /* Object for loc_id */
- H5VL_object_t * vol_obj_ptr = &vol_obj; /* Pointer to object for loc_id */
- H5VL_object_t **vol_obj_ptr_ptr = &vol_obj_ptr; /* Pointer to object pointer */
- void * token = NULL; /* Request token for async operation */
- void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t vol_obj; /* Object for loc_id */
+ H5VL_object_t *vol_obj_ptr = &vol_obj; /* Pointer to object for loc_id */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE10("e", "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id,
@@ -551,7 +601,7 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li
/* Creates a hard link asynchronously */
if (H5L__create_hard_api_common(cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, token_ptr,
- vol_obj_ptr_ptr) < 0)
+ &vol_obj_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to asynchronously create hard link")
/* If a token was created, add the token to the event set */
@@ -590,16 +640,16 @@ herr_t
H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id, const char *link_name,
hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- char * norm_obj_name = NULL; /* Pointer to normalized current name */
- void * ext_link_buf = NULL; /* Buffer to contain external link */
- size_t buf_size; /* Size of buffer to hold external link */
- size_t file_name_len; /* Length of file name string */
- size_t norm_obj_name_len; /* Length of normalized object name string */
- uint8_t * p; /* Pointer into external link buffer */
- H5L_type_t link_type = H5L_TYPE_EXTERNAL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ char * norm_obj_name = NULL; /* Pointer to normalized current name */
+ void * ext_link_buf = NULL; /* Buffer to contain external link */
+ size_t buf_size; /* Size of buffer to hold external link */
+ size_t file_name_len; /* Length of file name string */
+ size_t norm_obj_name_len; /* Length of normalized object name string */
+ uint8_t * p; /* Pointer into external link buffer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "*s*si*sii", file_name, obj_name, link_loc_id, link_name, lcpl_id, lapl_id);
@@ -650,10 +700,15 @@ H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_i
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_UD;
+ vol_cb_args.args.ud.type = H5L_TYPE_EXTERNAL;
+ vol_cb_args.args.ud.buf = ext_link_buf;
+ vol_cb_args.args.ud.buf_size = buf_size;
+
/* Create an external link */
- if (H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, ext_link_buf,
- buf_size) < 0)
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create external link")
done:
@@ -691,9 +746,10 @@ herr_t
H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, const void *udata,
size_t udata_size, hid_t lcpl_id, hid_t lapl_id)
{
- 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_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sLl*xzii", link_loc_id, link_name, link_type, udata, udata_size, lcpl_id, lapl_id);
@@ -726,9 +782,15 @@ H5Lcreate_ud(hid_t link_loc_id, const char *link_name, H5L_type_t link_type, con
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(link_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
- /* Create external link */
- if (H5VL_link_create(H5VL_LINK_CREATE_UD, vol_obj, &loc_params, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, (int)link_type, udata, udata_size) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_CREATE_UD;
+ vol_cb_args.args.ud.type = link_type;
+ vol_cb_args.args.ud.buf = udata;
+ vol_cb_args.args.ud.buf_size = udata_size;
+
+ /* Create user-defined link */
+ if (H5VL_link_create(&vol_cb_args, vol_obj, &loc_params, lcpl_id, lapl_id, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
done:
@@ -751,8 +813,9 @@ H5L__delete_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **tok
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -760,12 +823,14 @@ H5L__delete_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **tok
/* name is verified in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, TRUE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
- /* Unlink */
- if (H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, token_ptr) <
- 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_DELETE;
+
+ /* Delete link */
+ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -864,8 +929,9 @@ H5L__delete_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t i
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -878,13 +944,15 @@ H5L__delete_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t i
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, H5P_CLS_LACC, TRUE, lapl_id, vol_obj_ptr,
- &loc_params) < 0)
+ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, TRUE, lapl_id, vol_obj_ptr, &loc_params) <
+ 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_DELETE;
+
/* Delete the link */
- if (H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_DELETE, H5P_DATASET_XFER_DEFAULT, token_ptr) <
- 0)
+ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTDELETE, FAIL, "unable to delete link")
done:
@@ -993,9 +1061,10 @@ done:
herr_t
H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t lapl_id)
{
- 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_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sxzi", loc_id, name, buf, size, lapl_id);
@@ -1008,18 +1077,23 @@ H5Lget_val(hid_t loc_id, const char *name, void *buf /*out*/, size_t size, hid_t
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list 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;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* Get the location object */
+ /* Get the VOL object */
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_LINK, H5E_CANTGET, FAIL, "unable to get link value for '%s'", name)
done:
@@ -1048,9 +1122,10 @@ herr_t
H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
void *buf /*out*/, size_t size, hid_t lapl_id)
{
- 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_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, buf, size, lapl_id);
@@ -1067,6 +1142,7 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1075,13 +1151,17 @@ H5Lget_val_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the VOL object */
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_LINK, H5E_CANTGET, FAIL, "unable to get link value")
done:
@@ -1104,8 +1184,9 @@ H5L__exists_api_common(hid_t loc_id, const char *name, hbool_t *exists, hid_t la
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1115,12 +1196,15 @@ H5L__exists_api_common(hid_t loc_id, const char *name, hbool_t *exists, hid_t la
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid pointer for link existence")
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_EXISTS;
+ vol_cb_args.args.exists.exists = exists;
+
/* Check for the existence of the link */
- if (H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_EXISTS, H5P_DATASET_XFER_DEFAULT, token_ptr,
- exists) < 0)
+ if (H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1216,9 +1300,10 @@ done:
herr_t
H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t lapl_id)
{
- 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_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id);
@@ -1231,18 +1316,22 @@ H5Lget_info2(hid_t loc_id, const char *name, H5L_info2_t *linfo /*out*/, hid_t l
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list 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;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* get the location object */
+ /* Get the location object */
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_INFO;
+ vol_cb_args.args.get_info.linfo = linfo;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- linfo) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1267,9 +1356,10 @@ herr_t
H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5L_info2_t *linfo /*out*/, hid_t lapl_id)
{
- 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_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id);
@@ -1286,6 +1376,7 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1294,13 +1385,16 @@ H5Lget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the location object */
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_INFO;
+ vol_cb_args.args.get_info.linfo = linfo;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- linfo) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
done:
@@ -1463,9 +1557,11 @@ ssize_t
H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, char *name /*out*/, size_t size, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ size_t link_name_len = 0; /* Length of the link name string */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE8("Zs", "i*sIiIohxzi", loc_id, group_name, idx_type, order, n, name, size, lapl_id);
@@ -1482,7 +1578,7 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, (-1), "can't set access property list 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 = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1491,15 +1587,23 @@ H5Lget_name_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* Get the location object */
+ /* Get the VOL object */
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 = &link_name_len;
+
/* Get the link information */
- 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_LINK, H5E_CANTGET, (-1), "unable to get link name")
+ /* Set the return value */
+ ret_value = (ssize_t)link_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Lget_name_by_idx() */
@@ -1519,10 +1623,11 @@ H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_iter_order_t ord
{
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value = H5_ITER_CONT; /* Return value */
+ (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -1541,10 +1646,18 @@ H5L__iterate_api_common(hid_t group_id, H5_index_t idx_type, H5_iter_order_t ord
if (H5VL_setup_self_args(group_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(*vol_obj_ptr, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- token_ptr, (unsigned)FALSE, (int)idx_type, (int)order, idx_p, op,
- op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ token_ptr)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1663,9 +1776,10 @@ herr_t
H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx_p, H5L_iterate2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hLI*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id);
@@ -1696,9 +1810,18 @@ H5Literate_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
loc_params.loc_data.loc_by_name.name = group_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, op, op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -1736,10 +1859,11 @@ done:
herr_t
H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate2_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5I_type_t id_type; /* Type of ID */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5I_type_t id_type; /* Type of ID */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIoLI*x", group_id, idx_type, order, op, op_data);
@@ -1763,9 +1887,18 @@ H5Lvisit2(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(group_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -1804,9 +1937,10 @@ herr_t
H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
H5L_iterate2_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIoLI*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id);
@@ -1837,9 +1971,18 @@ H5Lvisit_by_name2(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
loc_params.loc_data.loc_by_name.name = group_name;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = op;
+ vol_cb_args.args.iterate.op_data = op_data;
+
/* Visit the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, op, op_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
diff --git a/src/H5Ldeprec.c b/src/H5Ldeprec.c
index df4c384..01e77f9 100644
--- a/src/H5Ldeprec.c
+++ b/src/H5Ldeprec.c
@@ -141,12 +141,13 @@ herr_t
H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t *idx_p, H5L_iterate1_t op,
void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5I_type_t id_type; /* Type of ID */
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIo*hLi*x", group_id, idx_type, order, idx_p, op, op_data);
@@ -181,10 +182,18 @@ H5Literate1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, hsize_t
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (unsigned)FALSE, (int)idx_type, (int)order, idx_p,
- H5L__iterate2_shim, (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -219,11 +228,12 @@ herr_t
H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t *idx_p, H5L_iterate1_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIo*hLi*xi", loc_id, group_name, idx_type, order, idx_p, op, op_data, lapl_id);
@@ -265,10 +275,18 @@ H5Literate_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = FALSE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = idx_p;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, FALSE, idx_type, order, idx_p, H5L__iterate2_shim,
- (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link iteration failed")
done:
@@ -293,11 +311,12 @@ done:
herr_t
H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_info2_t linfo2; /* New-style link info */
- hbool_t is_native_vol_obj;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_info2_t linfo2; /* New-style link info */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*sxi", loc_id, name, linfo, lapl_id);
@@ -310,12 +329,13 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, TRUE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list 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;
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -326,9 +346,12 @@ H5Lget_info1(hid_t loc_id, const char *name, H5L_info1_t *linfo /*out*/, hid_t l
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL,
"H5Lget_info1 is only meant to be used with the native VOL connector")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_INFO;
+ vol_cb_args.args.get_info.linfo = &linfo2;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &linfo2) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
/* Copy the new-style members into the old-style struct */
@@ -376,11 +399,12 @@ herr_t
H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5L_info1_t *linfo /*out*/, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_info2_t linfo2; /* New-style link info */
- hbool_t is_native_vol_obj;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_link_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_info2_t linfo2; /* New-style link info */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIohxi", loc_id, group_name, idx_type, order, n, linfo, lapl_id);
@@ -397,6 +421,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up location struct */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -405,7 +430,7 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
loc_params.loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
- /* get the location object */
+ /* Get the location object */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
@@ -416,9 +441,12 @@ H5Lget_info_by_idx1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
HGOTO_ERROR(H5E_LINK, H5E_BADVALUE, FAIL,
"H5Lget_info_by_idx1 is only meant to be used with the native VOL connector")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_GET_INFO;
+ vol_cb_args.args.get_info.linfo = &linfo2;
+
/* Get the link information */
- if (H5VL_link_get(vol_obj, &loc_params, H5VL_LINK_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &linfo2) < 0)
+ if (H5VL_link_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "unable to get link info")
/* Copy the new-style members into the old-style struct */
@@ -479,12 +507,13 @@ done:
herr_t
H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterate1_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5I_type_t id_type; /* Type of ID */
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5I_type_t id_type; /* Type of ID */
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIoLi*x", group_id, idx_type, order, op, op_data);
@@ -519,10 +548,18 @@ H5Lvisit1(hid_t group_id, H5_index_t idx_type, H5_iter_order_t order, H5L_iterat
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Iterate over the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim,
- (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
@@ -563,11 +600,12 @@ herr_t
H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
H5L_iterate1_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5L_shim_data_t shim_data;
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_link_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params;
+ H5L_shim_data_t shim_data;
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIoLi*xi", loc_id, group_name, idx_type, order, op, op_data, lapl_id);
@@ -609,10 +647,18 @@ H5Lvisit_by_name1(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_
shim_data.real_op = op;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_LINK_ITER;
+ vol_cb_args.args.iterate.recursive = TRUE;
+ vol_cb_args.args.iterate.idx_type = idx_type;
+ vol_cb_args.args.iterate.order = order;
+ vol_cb_args.args.iterate.idx_p = NULL;
+ vol_cb_args.args.iterate.op = H5L__iterate2_shim;
+ vol_cb_args.args.iterate.op_data = &shim_data;
+
/* Visit the links */
- if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, H5VL_LINK_ITER, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, TRUE, idx_type, order, NULL, H5L__iterate2_shim,
- (void *)&shim_data)) < 0)
+ if ((ret_value = H5VL_link_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
done:
diff --git a/src/H5Lexternal.c b/src/H5Lexternal.c
index eccd2c6..2f7c7eb 100644
--- a/src/H5Lexternal.c
+++ b/src/H5Lexternal.c
@@ -173,30 +173,30 @@ H5L__extern_traverse(const char H5_ATTR_UNUSED *link_name, hid_t cur_group, cons
/* Make callback if it exists */
if (cb_info.func) {
- const char *parent_file_name; /* Parent file name */
- ssize_t group_name_len; /* Length of parent group name */
+ const char *parent_file_name; /* Parent file name */
+ size_t group_name_len = 0; /* Length of parent group name */
/* Get parent file name */
parent_file_name = H5F_OPEN_NAME(loc.oloc->file);
/* Query length of parent group name */
- if ((group_name_len = H5G_get_name(&loc, NULL, (size_t)0, NULL)) < 0)
+ if (H5G_get_name(&loc, NULL, (size_t)0, &group_name_len, NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve length of group name")
/* Account for null terminator */
group_name_len++;
/* Check if we need to allocate larger buffer */
- if ((size_t)group_name_len > sizeof(local_group_name)) {
- if (NULL == (parent_group_name = (char *)H5MM_malloc((size_t)group_name_len)))
+ if (group_name_len > sizeof(local_group_name)) {
+ if (NULL == (parent_group_name = (char *)H5MM_malloc(group_name_len)))
HGOTO_ERROR(H5E_LINK, H5E_CANTALLOC, H5I_INVALID_HID,
- "can't allocate buffer to hold group name, group_name_len = %zd", group_name_len)
+ "can't allocate buffer to hold group name, group_name_len = %zu", group_name_len)
} /* end if */
else
parent_group_name = local_group_name;
/* Get parent group name */
- if (H5G_get_name(&loc, parent_group_name, (size_t)group_name_len, NULL) < 0)
+ if (H5G_get_name(&loc, parent_group_name, group_name_len, NULL, NULL) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, H5I_INVALID_HID, "unable to retrieve group name")
/* Make callback */
diff --git a/src/H5Lint.c b/src/H5Lint.c
index a8e9ba2..346c37d 100644
--- a/src/H5Lint.c
+++ b/src/H5Lint.c
@@ -47,6 +47,50 @@ typedef struct {
H5L_info2_t *linfo; /* Buffer to return to user */
} H5L_trav_gi_t;
+/* User data for path traversal routine for getting link value by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+ size_t size; /* Size of user buffer */
+
+ /* Out */
+ void *buf; /* User buffer */
+} H5L_trav_gvbi_t;
+
+/* User data for path traversal routine for getting link info by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+
+ /* Out */
+ H5L_info2_t *linfo; /* Buffer to return to user */
+} H5L_trav_gibi_t;
+
+/* User data for path traversal routine for removing link by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+} H5L_trav_rmbi_t;
+
+/* User data for path traversal routine for getting name by index */
+typedef struct {
+ /* In */
+ H5_index_t idx_type; /* Index to use */
+ H5_iter_order_t order; /* Order to iterate in index */
+ hsize_t n; /* Offset of link within index */
+ size_t size; /* Size of name buffer */
+
+ /* Out */
+ char * name; /* Buffer to return name to user */
+ size_t name_len; /* Length of full name */
+} H5L_trav_gnbi_t;
+
/* User data for path traversal callback to creating a link */
typedef struct {
H5F_t * file; /* Pointer to the file */
@@ -2012,8 +2056,8 @@ H5L__get_name_by_idx_cb(H5G_loc_t H5_ATTR_UNUSED *grp_loc /*in*/, const char H5_
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "group doesn't exist")
/* Query link */
- if ((udata->name_len = H5G_obj_get_name_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n,
- udata->name, udata->size)) < 0)
+ if (H5G_obj_get_name_by_idx(obj_loc->oloc, udata->idx_type, udata->order, udata->n, udata->name,
+ udata->size, &udata->name_len) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "link not found")
done:
@@ -2034,18 +2078,19 @@ done:
*
*-------------------------------------------------------------------------
*/
-ssize_t
+herr_t
H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, char *name /*out*/, size_t size)
+ hsize_t n, char *name /*out*/, size_t size, size_t *link_name_len)
{
- H5L_trav_gnbi_t udata; /* User data for callback */
- ssize_t ret_value = FAIL; /* Return value */
+ H5L_trav_gnbi_t udata; /* User data for callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
/* Check arguments */
HDassert(loc);
HDassert(group_name && *group_name);
+ HDassert(link_name_len);
/* Set up user data for callback */
udata.idx_type = idx_type;
@@ -2053,7 +2098,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id
udata.n = n;
udata.name = name;
udata.size = size;
- udata.name_len = -1;
+ udata.name_len = 0;
/* Traverse the group hierarchy to locate the link to get name of */
if (H5G_traverse(loc, group_name, H5G_TARGET_SLINK | H5G_TARGET_UDLINK, H5L__get_name_by_idx_cb, &udata) <
@@ -2061,7 +2106,7 @@ H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t id
HGOTO_ERROR(H5E_LINK, H5E_CANTGET, FAIL, "can't get name")
/* Set the return value */
- ret_value = udata.name_len;
+ *link_name_len = udata.name_len;
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2104,9 +2149,9 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t
/* Expand soft or external link, if requested */
if ((H5L_TYPE_SOFT == src_lnk->type && cpy_info->expand_soft_link) ||
(H5L_TYPE_EXTERNAL == src_lnk->type && cpy_info->expand_ext_link)) {
- H5G_loc_t lnk_grp_loc; /* Group location holding link */
- H5G_name_t lnk_grp_path; /* Path for link */
- htri_t tar_exists; /* Whether the target object exists */
+ H5G_loc_t lnk_grp_loc; /* Group location holding link */
+ H5G_name_t lnk_grp_path; /* Path for link */
+ hbool_t tar_exists = FALSE; /* Whether the target object exists */
/* Set up group location for link */
H5G_name_reset(&lnk_grp_path);
@@ -2114,7 +2159,7 @@ H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t
lnk_grp_loc.oloc = (H5O_loc_t *)src_oloc; /* Casting away const OK -QAK */
/* Check if the target object exists */
- if ((tar_exists = H5G_loc_exists(&lnk_grp_loc, src_lnk->name)) < 0)
+ if (H5G_loc_exists(&lnk_grp_loc, src_lnk->name, &tar_exists) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTCOPY, FAIL, "unable to check if target object exists")
if (tar_exists) {
diff --git a/src/H5Lmodule.h b/src/H5Lmodule.h
index 16f1f34..cffd25c 100644
--- a/src/H5Lmodule.h
+++ b/src/H5Lmodule.h
@@ -30,8 +30,29 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5L H5L
- * \brief Link Interface
- * \todo Describe concisely what the functions in this module are about.
+ *
+ * Use the functions in this module to manage HDF5 links and link types.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5L_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5L_examples.c iter_cb
+ * \snippet{lineno} H5L_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5L_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5L_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
* \defgroup TRAV Link Traversal
* \ingroup H5L
diff --git a/src/H5Lpkg.h b/src/H5Lpkg.h
index 7057e30..36a4d12 100644
--- a/src/H5Lpkg.h
+++ b/src/H5Lpkg.h
@@ -53,26 +53,27 @@
/* Package Private Prototypes */
/******************************/
-H5_DLL herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc,
- const char *link_name, hid_t lcpl_id);
-H5_DLL herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *cur_loc, const char *cur_name,
- hid_t lcpl_id);
-H5_DLL herr_t H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_data,
- size_t ud_data_size, H5L_type_t type, hid_t lcpl_id);
-H5_DLL herr_t H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists);
-H5_DLL herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/);
-H5_DLL ssize_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size);
-H5_DLL herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size);
-H5_DLL herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n, void *buf /*out*/, size_t size);
-H5_DLL herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc,
- const char *dst_name, hbool_t copy_flag, hid_t lcpl_id);
-H5_DLL herr_t H5L__delete(const H5G_loc_t *loc, const char *name);
-H5_DLL herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
- H5_iter_order_t order, hsize_t n);
-H5_DLL herr_t H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc,
- H5O_link_t *dst_lnk, H5O_copy_t *cpy_info);
+H5_DLL herr_t H5L__create_hard(H5G_loc_t *cur_loc, const char *cur_name, const H5G_loc_t *link_loc,
+ const char *link_name, hid_t lcpl_id);
+H5_DLL herr_t H5L__create_soft(const char *target_path, const H5G_loc_t *cur_loc, const char *cur_name,
+ hid_t lcpl_id);
+H5_DLL herr_t H5L__create_ud(const H5G_loc_t *link_loc, const char *link_name, const void *ud_data,
+ size_t ud_data_size, H5L_type_t type, hid_t lcpl_id);
+H5_DLL herr_t H5L__exists(const H5G_loc_t *loc, const char *name, hbool_t *exists);
+H5_DLL herr_t H5L__get_info_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, H5L_info2_t *linfo /*out*/);
+H5_DLL herr_t H5L__get_name_by_idx(const H5G_loc_t *loc, const char *group_name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, char *name /*out*/, size_t size,
+ size_t *name_len);
+H5_DLL herr_t H5L__get_val(const H5G_loc_t *loc, const char *name, void *buf /*out*/, size_t size);
+H5_DLL herr_t H5L__get_val_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n, void *buf /*out*/, size_t size);
+H5_DLL herr_t H5L__move(const H5G_loc_t *src_loc, const char *src_name, const H5G_loc_t *dst_loc,
+ const char *dst_name, hbool_t copy_flag, hid_t lcpl_id);
+H5_DLL herr_t H5L__delete(const H5G_loc_t *loc, const char *name);
+H5_DLL herr_t H5L__delete_by_idx(const H5G_loc_t *loc, const char *name, H5_index_t idx_type,
+ H5_iter_order_t order, hsize_t n);
+H5_DLL herr_t H5L__link_copy_file(H5F_t *dst_file, const H5O_link_t *_src_lnk, const H5O_loc_t *src_oloc,
+ H5O_link_t *dst_lnk, H5O_copy_t *cpy_info);
#endif /* H5Lpkg_H */
diff --git a/src/H5Lprivate.h b/src/H5Lprivate.h
index 53b8726..98e3051 100644
--- a/src/H5Lprivate.h
+++ b/src/H5Lprivate.h
@@ -52,50 +52,6 @@
/* Library Private Typedefs */
/****************************/
-/* User data for path traversal routine for getting link value by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
- size_t size; /* Size of user buffer */
-
- /* Out */
- void *buf; /* User buffer */
-} H5L_trav_gvbi_t;
-
-/* User data for path traversal routine for getting link info by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
-
- /* Out */
- H5L_info2_t *linfo; /* Buffer to return to user */
-} H5L_trav_gibi_t;
-
-/* User data for path traversal routine for getting name by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
- size_t size; /* Size of name buffer */
-
- /* Out */
- char * name; /* Buffer to return name to user */
- ssize_t name_len; /* Length of full name */
-} H5L_trav_gnbi_t;
-
-/* User data for path traversal routine for removing link by index */
-typedef struct {
- /* In */
- H5_index_t idx_type; /* Index to use */
- H5_iter_order_t order; /* Order to iterate in index */
- hsize_t n; /* Offset of link within index */
-} H5L_trav_rmbi_t;
-
/* Structure for external link traversal callback property */
typedef struct H5L_elink_cb_t {
H5L_elink_traverse_t func;
diff --git a/src/H5Lpublic.h b/src/H5Lpublic.h
index f665526..72b0182 100644
--- a/src/H5Lpublic.h
+++ b/src/H5Lpublic.h
@@ -1380,6 +1380,7 @@ H5_DLL herr_t H5Lunpack_elink_val(const void *ext_linkval /*in*/, size_t link_si
H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hid_t link_loc_id,
const char *link_name, hid_t lcpl_id, hid_t lapl_id);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1401,6 +1402,7 @@ H5_DLL herr_t H5Lcreate_external(const char *file_name, const char *obj_name, hi
#define H5Lexists_async_wrap H5_NO_EXPAND(H5Lexists_async)
#define H5Literate_async_wrap H5_NO_EXPAND(H5Literate_async)
#endif /* H5L_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5M.c b/src/H5M.c
index f3cc2ea..845c054 100644
--- a/src/H5M.c
+++ b/src/H5M.c
@@ -211,15 +211,20 @@ H5M_term_package(void)
static herr_t
H5M__close_cb(H5VL_object_t *map_vol_obj, void **request)
{
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
/* Sanity check */
HDassert(map_vol_obj);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
/* Close the map */
- if (H5VL_optional(map_vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, request) < 0)
+ if (H5VL_optional(map_vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, request) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CLOSEERROR, FAIL, "unable to close map");
/* Free the VOL object */
@@ -251,8 +256,9 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t
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 */
- H5VL_loc_params_t loc_params; /* Location parameters */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -274,14 +280,24 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t
else if (TRUE != H5P_isa_class(mcpl_id, H5P_MAP_CREATE))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "mcpl_id is not a map create property list ID")
- /* Set up object access arguments */
- if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, TRUE, &mapl_id, vol_obj_ptr, &loc_params) < 0)
+ /* Set up VOL callback arguments */
+ if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, TRUE, &mapl_id, vol_obj_ptr, &map_args.create.loc_params) <
+ 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
+ map_args.create.name = name;
+ map_args.create.lcpl_id = lcpl_id;
+ map_args.create.key_type_id = key_type_id;
+ map_args.create.val_type_id = val_type_id;
+ map_args.create.mcpl_id = mcpl_id;
+ map_args.create.mapl_id = mapl_id;
+ map_args.create.map = NULL;
+ vol_cb_args.op_type = H5VL_MAP_CREATE;
+ vol_cb_args.args = &map_args;
/* Create the map */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params, name,
- lcpl_id, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
+ map = map_args.create.map;
/* Get an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, (*vol_obj_ptr)->connector, TRUE)) < 0)
@@ -289,9 +305,14 @@ H5M__create_api_common(hid_t loc_id, const char *name, hid_t key_type_id, hid_t
done:
/* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(*vol_obj_ptr, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
+ if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5M__create_api_common() */
@@ -407,10 +428,11 @@ done:
hid_t
H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id, hid_t mapl_id)
{
- void * map = NULL; /* map object from VOL connector */
- H5VL_object_t * vol_obj = NULL; /* object of loc_id */
- H5VL_loc_params_t loc_params;
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ void * map = NULL; /* map object from VOL connector */
+ H5VL_object_t * vol_obj = NULL; /* object of loc_id */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE5("i", "iiiii", loc_id, key_type_id, val_type_id, mcpl_id, mapl_id);
@@ -430,13 +452,24 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
/* Set location parameters */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(loc_id);
+
+ /* Set up VOL callback arguments */
+ map_args.create.loc_params.type = H5VL_OBJECT_BY_SELF;
+ map_args.create.loc_params.obj_type = H5I_get_type(loc_id);
+ map_args.create.name = NULL;
+ map_args.create.lcpl_id = H5P_LINK_CREATE_DEFAULT;
+ map_args.create.key_type_id = key_type_id;
+ map_args.create.val_type_id = val_type_id;
+ map_args.create.mcpl_id = mcpl_id;
+ map_args.create.mapl_id = mapl_id;
+ map_args.create.map = NULL;
+ vol_cb_args.op_type = H5VL_MAP_CREATE;
+ vol_cb_args.args = &map_args;
/* Create the map */
- if (H5VL_optional(vol_obj, H5VL_MAP_CREATE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, &loc_params, NULL,
- H5P_LINK_CREATE_DEFAULT, key_type_id, val_type_id, mcpl_id, mapl_id, &map) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTINIT, H5I_INVALID_HID, "unable to create map")
+ map = map_args.create.map;
/* Get an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, vol_obj->connector, TRUE)) < 0)
@@ -444,9 +477,14 @@ H5Mcreate_anon(hid_t loc_id, hid_t key_type_id, hid_t val_type_id, hid_t mcpl_id
done:
/* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
+ if (map && H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+ } /* end if */
FUNC_LEAVE_API(ret_value)
} /* end H5Mcreate_anon() */
@@ -470,8 +508,9 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token
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 */
- H5VL_loc_params_t loc_params; /* Location parameters */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -481,14 +520,20 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token
if (!*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, H5I_INVALID_HID, "name parameter cannot be an empty string")
- /* Set up object access arguments */
- if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, FALSE, &mapl_id, vol_obj_ptr, &loc_params) < 0)
+ /* Set up VOL callback arguments */
+ if (H5VL_setup_acc_args(loc_id, H5P_CLS_MACC, FALSE, &mapl_id, vol_obj_ptr, &map_args.open.loc_params) <
+ 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
+ map_args.open.name = name;
+ map_args.open.mapl_id = mapl_id;
+ map_args.open.map = NULL;
+ vol_cb_args.op_type = H5VL_MAP_OPEN;
+ vol_cb_args.args = &map_args;
/* Open the map */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_OPEN, H5P_DATASET_XFER_DEFAULT, token_ptr, &loc_params, name,
- mapl_id, &map) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTOPENOBJ, H5I_INVALID_HID, "unable to open map")
+ map = map_args.open.map;
/* Register an ID for the map */
if ((ret_value = H5VL_register(H5I_MAP, map, (*vol_obj_ptr)->connector, TRUE)) < 0)
@@ -496,9 +541,14 @@ H5M__open_api_common(hid_t loc_id, const char *name, hid_t mapl_id, void **token
done:
/* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(*vol_obj_ptr, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ if (H5I_INVALID_HID == ret_value) {
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_MAP_CLOSE;
+ vol_cb_args.args = NULL;
+
+ if (map && H5VL_optional(*vol_obj_ptr, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5M__open_api_common() */
@@ -521,9 +571,7 @@ done:
hid_t
H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
{
- void * map = NULL; /* map object from VOL connector */
- H5VL_object_t *vol_obj = NULL; /* object of loc_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)
H5TRACE3("i", "i*si", loc_id, name, mapl_id);
@@ -533,11 +581,6 @@ H5Mopen(hid_t loc_id, const char *name, hid_t mapl_id)
HGOTO_ERROR(H5E_MAP, H5E_CANTCREATE, H5I_INVALID_HID, "unable to open map synchronously")
done:
- /* Cleanup on failure */
- if (H5I_INVALID_HID == ret_value)
- if (map && H5VL_optional(vol_obj, H5VL_MAP_CLOSE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
- HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, H5I_INVALID_HID, "unable to release map")
-
FUNC_LEAVE_API(ret_value)
} /* end H5Mopen() */
@@ -697,8 +740,10 @@ done:
hid_t
H5Mget_key_type(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -707,10 +752,18 @@ H5Mget_key_type(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
- /* get the datatype */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_KEY_TYPE,
- &ret_value) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_KEY_TYPE;
+ map_args.get.args.get_key_type.type_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
+ /* Get the key datatype */
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get key datatype")
+
+ /* Set return value */
+ ret_value = map_args.get.args.get_key_type.type_id;
done:
FUNC_LEAVE_API(ret_value)
@@ -732,8 +785,10 @@ done:
hid_t
H5Mget_val_type(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -742,10 +797,18 @@ H5Mget_val_type(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
- /* get the datatype */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_VAL_TYPE,
- &ret_value) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get datatype")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_VAL_TYPE;
+ map_args.get.args.get_val_type.type_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
+ /* Get the value datatype */
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get value datatype")
+
+ /* Set return value */
+ ret_value = map_args.get.args.get_val_type.type_id;
done:
FUNC_LEAVE_API(ret_value)
@@ -767,8 +830,10 @@ done:
hid_t
H5Mget_create_plist(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -777,11 +842,19 @@ H5Mget_create_plist(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_MCPL;
+ map_args.get.args.get_mcpl.mcpl_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
/* Get the map creation property list */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MCPL,
- &ret_value) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map creation properties")
+ /* Set return value */
+ ret_value = map_args.get.args.get_mcpl.mcpl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Mget_create_plist() */
@@ -805,8 +878,10 @@ done:
hid_t
H5Mget_access_plist(hid_t map_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE1("i", "i", map_id);
@@ -815,11 +890,19 @@ H5Mget_access_plist(hid_t map_id)
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(map_id, H5I_MAP)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid map identifier")
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_MAPL;
+ map_args.get.args.get_mapl.mapl_id = H5I_INVALID_HID;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
/* Get the map access property list */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5VL_MAP_GET_MAPL,
- &ret_value) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
+ /* Set return value */
+ ret_value = map_args.get.args.get_mapl.mapl_id;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Mget_access_plist() */
@@ -839,8 +922,10 @@ done:
herr_t
H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id)
{
- H5VL_object_t *vol_obj; /* Map structure */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj; /* Map structure */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("e", "ixi", map_id, count, dxpl_id);
@@ -858,9 +943,19 @@ H5Mget_count(hid_t map_id, hsize_t *count /*out*/, hid_t dxpl_id)
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.get.get_type = H5VL_MAP_GET_COUNT;
+ map_args.get.args.get_count.count = 0;
+ vol_cb_args.op_type = H5VL_MAP_GET;
+ vol_cb_args.args = &map_args;
+
/* Get the number of key-value pairs stored in the map */
- if (H5VL_optional(vol_obj, H5VL_MAP_GET, dxpl_id, H5_REQUEST_NULL, H5VL_MAP_GET_COUNT, count) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get map access properties")
+ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
+ HGOTO_ERROR(H5E_MAP, H5E_CANTGET, H5I_INVALID_HID, "unable to get KV pair count for map")
+
+ /* Set value to return */
+ if (count)
+ *count = map_args.get.args.get_count.count;
done:
FUNC_LEAVE_API(ret_value)
@@ -882,7 +977,9 @@ H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
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_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -905,9 +1002,16 @@ H5M__put_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.put.key_mem_type_id = key_mem_type_id;
+ map_args.put.key = key;
+ map_args.put.value_mem_type_id = val_mem_type_id;
+ map_args.put.value = value;
+ vol_cb_args.op_type = H5VL_MAP_PUT;
+ vol_cb_args.args = &map_args;
+
/* Set the key/value pair */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_PUT, dxpl_id, token_ptr, key_mem_type_id, key, val_mem_type_id,
- value) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to put key/value pair")
done:
@@ -1008,7 +1112,9 @@ H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
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_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1031,9 +1137,16 @@ H5M__get_api_common(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.get_val.key_mem_type_id = key_mem_type_id;
+ map_args.get_val.key = key;
+ map_args.get_val.value_mem_type_id = val_mem_type_id;
+ map_args.get_val.value = value;
+ vol_cb_args.op_type = H5VL_MAP_GET_VAL;
+ vol_cb_args.args = &map_args;
+
/* Get the value for the key */
- if (H5VL_optional(*vol_obj_ptr, H5VL_MAP_GET_VAL, dxpl_id, token_ptr, key_mem_type_id, key,
- val_mem_type_id, value) < 0)
+ if (H5VL_optional(*vol_obj_ptr, &vol_cb_args, dxpl_id, token_ptr) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, FAIL, "unable to get value from map")
done:
@@ -1137,8 +1250,10 @@ done:
herr_t
H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists, hid_t dxpl_id)
{
- H5VL_object_t *vol_obj = NULL;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*x*bi", map_id, key_mem_type_id, key, exists, dxpl_id);
@@ -1160,11 +1275,21 @@ H5Mexists(hid_t map_id, hid_t key_mem_type_id, const void *key, hbool_t *exists,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
+ /* Set up VOL callback arguments */
+ map_args.exists.key_mem_type_id = key_mem_type_id;
+ map_args.exists.key = key;
+ map_args.exists.exists = FALSE;
+ vol_cb_args.op_type = H5VL_MAP_EXISTS;
+ vol_cb_args.args = &map_args;
+
/* Check if key exists */
- if ((ret_value = H5VL_optional(vol_obj, H5VL_MAP_EXISTS, dxpl_id, H5_REQUEST_NULL, key_mem_type_id, key,
- exists)) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTGET, ret_value, "unable to check if key exists")
+ /* Set value to return */
+ if (exists)
+ *exists = map_args.exists.exists;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Mexists() */
@@ -1203,9 +1328,10 @@ done:
herr_t
H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op, void *op_data, hid_t dxpl_id)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "i*hiMI*xi", map_id, idx, key_mem_type_id, op, op_data, dxpl_id);
@@ -1229,14 +1355,24 @@ H5Miterate(hid_t map_id, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Set location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(map_id);
+ /* Set up VOL callback arguments */
+ map_args.specific.specific_type = H5VL_MAP_ITER;
+ map_args.specific.args.iterate.loc_params.type = H5VL_OBJECT_BY_SELF;
+ map_args.specific.args.iterate.loc_params.obj_type = H5I_get_type(map_id);
+ map_args.specific.args.iterate.idx = (idx ? *idx : 0);
+ map_args.specific.args.iterate.key_mem_type_id = key_mem_type_id;
+ map_args.specific.args.iterate.op = op;
+ map_args.specific.args.iterate.op_data = op_data;
+ vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
+ vol_cb_args.args = &map_args;
/* Iterate over keys */
- if ((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params,
- H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to iterate over keys")
+ if ((ret_value = H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
+ HERROR(H5E_MAP, H5E_BADITER, "unable to iterate over keys");
+
+ /* Set value to return */
+ if (idx)
+ *idx = map_args.specific.args.iterate.idx;
done:
FUNC_LEAVE_API(ret_value)
@@ -1277,9 +1413,10 @@ herr_t
H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_mem_type_id, H5M_iterate_t op,
void *op_data, hid_t dxpl_id, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*s*hiMI*xii", loc_id, map_name, idx, key_mem_type_id, op, op_data, dxpl_id, lapl_id);
@@ -1307,16 +1444,26 @@ H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *idx, hid_t key_m
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Set location struct fields */
- loc_params.type = H5VL_OBJECT_BY_NAME;
- loc_params.obj_type = H5I_get_type(loc_id);
- loc_params.loc_data.loc_by_name.name = map_name;
- loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ /* Set up VOL callback arguments */
+ map_args.specific.specific_type = H5VL_MAP_ITER;
+ map_args.specific.args.iterate.loc_params.type = H5VL_OBJECT_BY_NAME;
+ map_args.specific.args.iterate.loc_params.obj_type = H5I_get_type(loc_id);
+ map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.name = map_name;
+ map_args.specific.args.iterate.loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
+ map_args.specific.args.iterate.idx = (idx ? *idx : 0);
+ map_args.specific.args.iterate.key_mem_type_id = key_mem_type_id;
+ map_args.specific.args.iterate.op = op;
+ map_args.specific.args.iterate.op_data = op_data;
+ vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
+ vol_cb_args.args = &map_args;
/* Iterate over keys */
- if ((ret_value = H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params,
- H5VL_MAP_ITER, idx, key_mem_type_id, op, op_data)) < 0)
- HGOTO_ERROR(H5E_MAP, H5E_BADITER, ret_value, "unable to ierate over keys")
+ if ((ret_value = H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL)) < 0)
+ HERROR(H5E_MAP, H5E_BADITER, "unable to ierate over keys");
+
+ /* Set value to return */
+ if (idx)
+ *idx = map_args.specific.args.iterate.idx;
done:
FUNC_LEAVE_API(ret_value)
@@ -1340,9 +1487,10 @@ done:
herr_t
H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id)
{
- H5VL_object_t * vol_obj = NULL;
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL;
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_map_args_t map_args; /* Arguments for map operations */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "ii*xi", map_id, key_mem_type_id, key, dxpl_id);
@@ -1364,13 +1512,17 @@ H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id)
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- /* Set location struct fields */
- loc_params.type = H5VL_OBJECT_BY_SELF;
- loc_params.obj_type = H5I_get_type(map_id);
+ /* Set up VOL callback arguments */
+ map_args.specific.specific_type = H5VL_MAP_DELETE;
+ map_args.specific.args.del.loc_params.type = H5VL_OBJECT_BY_SELF;
+ map_args.specific.args.del.loc_params.obj_type = H5I_get_type(map_id);
+ map_args.specific.args.del.key_mem_type_id = key_mem_type_id;
+ map_args.specific.args.del.key = key;
+ vol_cb_args.op_type = H5VL_MAP_SPECIFIC;
+ vol_cb_args.args = &map_args;
/* Delete the key/value pair */
- if (H5VL_optional(vol_obj, H5VL_MAP_SPECIFIC, dxpl_id, H5_REQUEST_NULL, &loc_params, H5VL_MAP_DELETE,
- key_mem_type_id, key) < 0)
+ if (H5VL_optional(vol_obj, &vol_cb_args, dxpl_id, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_MAP, H5E_CANTSET, FAIL, "unable to delete key/value pair")
done:
diff --git a/src/H5MF.c b/src/H5MF.c
index fd38495..ca780c3 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -2463,15 +2463,15 @@ done:
* Purpose: To retrieve free-space section information for
* paged or non-paged aggregation
*
- * Return: Success: Number of free sections
- * Failure: -1
+ * Return: SUCCEED/FAIL
*
* Programmer: Vailin Choi; Dec 2012
*
*-------------------------------------------------------------------------
*/
-ssize_t
-H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info)
+herr_t
+H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info,
+ size_t *sect_count)
{
H5AC_ring_t orig_ring = H5AC_RING_INV; /* Original ring value */
H5AC_ring_t curr_ring = H5AC_RING_INV; /* Current ring value */
@@ -2480,9 +2480,9 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
H5MF_sect_iter_ud_t sect_udata; /* User data for callback */
H5F_mem_page_t start_type, end_type; /* Memory types to iterate over */
H5F_mem_page_t ty; /* Memory type for iteration */
- ssize_t ret_value = -1; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, (-1))
+ FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL)
/* check args */
HDassert(f);
@@ -2544,7 +2544,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
if (!f->shared->fs_man[ty] && H5F_addr_defined(f->shared->fs_addr[ty])) {
if (H5MF__open_fstype(f, ty) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1), "can't open the free space manager")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't open the free space manager")
HDassert(f->shared->fs_man[ty]);
fs_started = TRUE;
} /* end if */
@@ -2552,7 +2552,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
/* Check if there's free space sections of this type */
if (f->shared->fs_man[ty])
if (H5MF__get_free_sects(f, f->shared->fs_man[ty], &sect_udata, &nums) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, (-1),
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL,
"can't get section info for the free space manager")
/* Increment total # of sections */
@@ -2561,13 +2561,13 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t
/* Close the free space manager of this type, if we started it here */
if (fs_started)
if (H5MF__close_fstype(f, ty) < 0)
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, (-1), "can't close file free space")
+ HGOTO_ERROR(H5E_RESOURCE, H5E_CANTCLOSEOBJ, FAIL, "can't close file free space")
if ((H5F_PAGED_AGGR(f)) && (type != H5FD_MEM_DEFAULT))
ty = (H5F_mem_page_t)(ty + H5FD_MEM_NTYPES - 2);
} /* end for */
- /* Set return value */
- ret_value = (ssize_t)total_sects;
+ /* Set value to return */
+ *sect_count = total_sects;
done:
/* Reset the ring in the API context */
diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h
index 81bf36d..e55b00f 100644
--- a/src/H5MFprivate.h
+++ b/src/H5MFprivate.h
@@ -56,7 +56,8 @@ H5_DLL haddr_t H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t type, hsize_t size);
H5_DLL herr_t H5MF_xfree(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size);
H5_DLL herr_t H5MF_try_extend(H5F_t *f, H5FD_mem_t type, haddr_t addr, hsize_t size, hsize_t extra_requested);
H5_DLL htri_t H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size);
-H5_DLL ssize_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info);
+H5_DLL herr_t H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t *sect_info,
+ size_t *sect_count);
/* File 'temporary' space allocation routines */
H5_DLL haddr_t H5MF_alloc_tmp(H5F_t *f, hsize_t size);
diff --git a/src/H5Mmodule.h b/src/H5Mmodule.h
index 3dae3e2..848f63f 100644
--- a/src/H5Mmodule.h
+++ b/src/H5Mmodule.h
@@ -26,9 +26,9 @@
#define H5_MY_PKG_ERR H5E_MAP
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5M H5M
- * \brief Map Interface
+/**\defgroup H5M H5M
+ *
+ * \todo Describe the map life cycle.
*
* \details \Bold{The interface can only be used with the HDF5 VOL connectors that
* implement map objects.} The native HDF5 library does not support this
diff --git a/src/H5Mprivate.h b/src/H5Mprivate.h
index 1a2524e..e62434a 100644
--- a/src/H5Mprivate.h
+++ b/src/H5Mprivate.h
@@ -21,10 +21,9 @@
#include "H5Mpublic.h"
/* Private headers needed by this file */
-#include "H5FDprivate.h" /* File drivers */
-#include "H5Oprivate.h" /* Object headers */
-#include "H5Sprivate.h" /* Dataspaces */
-#include "H5Zprivate.h" /* Data filters */
+#include "H5Oprivate.h" /* Object headers */
+#include "H5Sprivate.h" /* Dataspaces */
+#include "H5Zprivate.h" /* Data filters */
/**************************/
/* Library Private Macros */
diff --git a/src/H5Mpublic.h b/src/H5Mpublic.h
index 3f6bf01..3f94edb 100644
--- a/src/H5Mpublic.h
+++ b/src/H5Mpublic.h
@@ -25,6 +25,7 @@
/* Public headers needed by this file */
#include "H5public.h"
#include "H5Ipublic.h"
+#include "H5VLconnector.h"
/*****************/
/* Public Macros */
@@ -68,6 +69,115 @@ typedef enum H5VL_map_specific_t {
typedef herr_t (*H5M_iterate_t)(hid_t map_id, const void *key, void *op_data);
//! <!-- [H5M_iterate_t_snip] -->
+/* Parameters for map operations */
+typedef union H5VL_map_args_t {
+ /* H5VL_MAP_CREATE */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ const char * name; /* Name of new map object */
+ hid_t lcpl_id; /* Link creation property list for map */
+ hid_t key_type_id; /* Datatype for map keys */
+ hid_t val_type_id; /* Datatype for map values */
+ hid_t mcpl_id; /* Map creation property list */
+ hid_t mapl_id; /* Map access property list */
+ void * map; /* Pointer to newly created map object (OUT) */
+ } create;
+
+ /* H5VL_MAP_OPEN */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ const char * name; /* Name of new map object */
+ hid_t mapl_id; /* Map access property list */
+ void * map; /* Pointer to newly created map object (OUT) */
+ } open;
+
+ /* H5VL_MAP_GET_VAL */
+ struct {
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void *key; /* Pointer to key */
+ hid_t value_mem_type_id; /* Memory datatype for value */
+ void * value; /* Buffer for value (OUT) */
+ } get_val;
+
+ /* H5VL_MAP_EXISTS */
+ struct {
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void *key; /* Pointer to key */
+ hbool_t exists; /* Flag indicating whether key exists in map (OUT) */
+ } exists;
+
+ /* H5VL_MAP_PUT */
+ struct {
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void *key; /* Pointer to key */
+ hid_t value_mem_type_id; /* Memory datatype for value */
+ const void *value; /* Pointer to value */
+ } put;
+
+ /* H5VL_MAP_GET */
+ struct {
+ H5VL_map_get_t get_type; /* 'get' operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_MAP_GET_MAPL */
+ struct {
+ hid_t mapl_id; /* Map access property list ID (OUT) */
+ } get_mapl;
+
+ /* H5VL_MAP_GET_MCPL */
+ struct {
+ hid_t mcpl_id; /* Map creation property list ID (OUT) */
+ } get_mcpl;
+
+ /* H5VL_MAP_GET_KEY_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID for map's keys (OUT) */
+ } get_key_type;
+
+ /* H5VL_MAP_GET_VAL_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID for map's values (OUT) */
+ } get_val_type;
+
+ /* H5VL_MAP_GET_COUNT */
+ struct {
+ hsize_t count; /* # of KV pairs in map (OUT) */
+ } get_count;
+ } args;
+ } get;
+
+ /* H5VL_MAP_SPECIFIC */
+ struct {
+ H5VL_map_specific_t specific_type; /* 'specific' operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_MAP_ITER */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ hsize_t idx; /* Start/end iteration index (IN/OUT) */
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ H5M_iterate_t op; /* Iteration callback routine */
+ void * op_data; /* Pointer to callback context */
+ } iterate;
+
+ /* H5VL_MAP_DELETE */
+ struct {
+ H5VL_loc_params_t loc_params; /* Location parameters for object */
+ hid_t key_mem_type_id; /* Memory datatype for key */
+ const void * key; /* Pointer to key */
+ } del;
+ } args;
+ } specific;
+
+ /* H5VL_MAP_OPTIONAL */
+ /* Unused */
+
+ /* H5VL_MAP_CLOSE */
+ /* No args */
+} H5VL_map_args_t;
+
/********************/
/* Public Variables */
/********************/
@@ -478,6 +588,7 @@ H5_DLL herr_t H5Miterate_by_name(hid_t loc_id, const char *map_name, hsize_t *id
*/
H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hid_t dxpl_id);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -496,6 +607,7 @@ H5_DLL herr_t H5Mdelete(hid_t map_id, hid_t key_mem_type_id, const void *key, hi
#define H5Mput_async_wrap H5_NO_EXPAND(H5Mput_async)
#define H5Mget_async_wrap H5_NO_EXPAND(H5Mget_async)
#endif /* H5M_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5O.c b/src/H5O.c
index 732473f..db3ff31 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -70,7 +70,7 @@ static herr_t H5O__copy_api_common(hid_t src_loc_id, const char *src_name, hid_t
H5VL_object_t **_vol_obj_ptr);
static herr_t H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_ptr);
static herr_t H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_ptr);
-static htri_t H5O__close_check_common(hid_t object_id);
+static htri_t H5O__close_check_type(hid_t object_id);
/*********************/
/* Package Variables */
@@ -112,7 +112,7 @@ H5O__open_api_common(hid_t loc_id, const char *name, hid_t lapl_id, void **token
/* name is checked in this H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
/* Open the object */
@@ -239,7 +239,7 @@ H5O__open_by_idx_api_common(hid_t loc_id, const char *group_name, H5_index_t idx
/* Check args */
/* group_name, idx_type, order are checked in H5VL_setup_idx-args() */
/* Set up object access arguments */
- if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr,
+ if (H5VL_setup_idx_args(loc_id, group_name, idx_type, order, n, FALSE, lapl_id, vol_obj_ptr,
&loc_params) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTSET, H5I_INVALID_HID, "can't set object access arguments")
@@ -617,8 +617,9 @@ H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_p
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -626,9 +627,13 @@ H5O__flush_api_common(hid_t obj_id, void **token_ptr, H5VL_object_t **_vol_obj_p
if (H5VL_setup_loc_args(obj_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_FLUSH;
+ vol_cb_args.args.flush.obj_id = obj_id;
+
/* Flush the object */
- if (H5VL_object_specific(*vol_obj_ptr, &loc_params, H5VL_OBJECT_FLUSH, H5P_DATASET_XFER_DEFAULT,
- token_ptr, obj_id) < 0)
+ if (H5VL_object_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
done:
@@ -718,8 +723,9 @@ H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_pt
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -727,9 +733,13 @@ H5O__refresh_api_common(hid_t oid, void **token_ptr, H5VL_object_t **_vol_obj_pt
if (H5VL_setup_loc_args(oid, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_REFRESH;
+ vol_cb_args.args.refresh.obj_id = oid;
+
/* Refresh the object */
- if (H5VL_object_specific(*vol_obj_ptr, &loc_params, H5VL_OBJECT_REFRESH, H5P_DATASET_XFER_DEFAULT,
- token_ptr, oid) < 0)
+ if (H5VL_object_specific(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
done:
@@ -828,12 +838,12 @@ done:
herr_t
H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid_t lapl_id)
{
- H5VL_object_t * vol_obj1 = NULL; /* object of obj_id */
- H5VL_object_t * vol_obj2 = NULL; /* object of new_loc_id */
- H5VL_object_t tmp_vol_obj; /* Temporary object */
- H5VL_loc_params_t loc_params1;
- H5VL_loc_params_t loc_params2;
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj1 = NULL; /* object of obj_id */
+ H5VL_object_t * vol_obj2 = NULL; /* object of new_loc_id */
+ H5VL_object_t tmp_vol_obj; /* Temporary object */
+ H5VL_link_create_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t new_loc_params;
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "ii*sii", obj_id, new_loc_id, new_name, lcpl_id, lapl_id);
@@ -863,36 +873,45 @@ H5Olink(hid_t obj_id, hid_t new_loc_id, const char *new_name, hid_t lcpl_id, hid
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, obj_id, TRUE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
- loc_params1.type = H5VL_OBJECT_BY_SELF;
- loc_params1.obj_type = H5I_get_type(obj_id);
-
- 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 = lapl_id;
+ /* 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 = lapl_id;
- if (H5L_SAME_LOC != obj_id)
- /* get the location object */
- if (NULL == (vol_obj1 = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Get the first location object */
+ if (NULL == (vol_obj1 = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
if (H5L_SAME_LOC != new_loc_id)
/* get the location object */
if (NULL == (vol_obj2 = H5VL_vol_object(new_loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
/* Make sure that the VOL connectors are the same */
- if (vol_obj1 && vol_obj2)
- if (vol_obj1->connector->cls->value != vol_obj2->connector->cls->value)
+ if (vol_obj1 && vol_obj2) {
+ int same_connector = 0;
+
+ /* Check if both objects are associated with the same VOL connector */
+ if (H5VL_cmp_connector_cls(&same_connector, vol_obj1->connector->cls, vol_obj2->connector->cls) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTCOMPARE, FAIL, "can't compare connector classes")
+ if (same_connector)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL,
"Objects are accessed through different VOL connectors and can't be linked")
+ } /* end if */
/* Construct a temporary VOL object */
tmp_vol_obj.data = vol_obj2->data;
- tmp_vol_obj.connector = (vol_obj1 != NULL ? vol_obj1->connector : vol_obj2->connector);
+ tmp_vol_obj.connector = vol_obj1->connector;
+
+ /* 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_SELF;
+ vol_cb_args.args.hard.curr_loc_params.obj_type = H5I_get_type(obj_id);
/* Create a link to the object */
- if (H5VL_link_create(H5VL_LINK_CREATE_HARD, &tmp_vol_obj, &loc_params2, lcpl_id, lapl_id,
- H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, vol_obj1->data, &loc_params1) < 0)
+ if (H5VL_link_create(&vol_cb_args, &tmp_vol_obj, &new_loc_params, lcpl_id, lapl_id,
+ H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCREATE, FAIL, "unable to create link")
done:
@@ -922,9 +941,10 @@ done:
herr_t
H5Oincr_refcount(hid_t object_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value = SUCCEED;
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -940,9 +960,13 @@ H5Oincr_refcount(hid_t object_id)
if (H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_CHANGE_REF_COUNT;
+ vol_cb_args.args.change_rc.delta = 1;
+
/* Change the object's reference count */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, 1) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -972,9 +996,10 @@ done:
herr_t
H5Odecr_refcount(hid_t object_id)
{
- 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_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "i", object_id);
@@ -990,9 +1015,13 @@ H5Odecr_refcount(hid_t object_id)
if (H5CX_set_loc(object_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_CHANGE_REF_COUNT;
+ vol_cb_args.args.change_rc.delta = -1;
+
/* Change the object's reference count */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_CHANGE_REF_COUNT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, -1) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
done:
@@ -1015,9 +1044,11 @@ done:
htri_t
H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- htri_t ret_value = FAIL; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ hbool_t obj_exists = FALSE; /* Whether object exists */
+ htri_t ret_value = FAIL; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("t", "i*si", loc_id, name, lapl_id);
@@ -1042,11 +1073,18 @@ H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id)
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_EXISTS;
+ vol_cb_args.args.exists.exists = &obj_exists;
+
/* Check if the object exists */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_EXISTS, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &ret_value) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists", name)
+ /* Set return value */
+ ret_value = (htri_t)obj_exists;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oexists_by_name() */
@@ -1066,9 +1104,10 @@ done:
herr_t
H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields)
{
- 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_object_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)
H5TRACE3("e", "ixIu", loc_id, oinfo, fields);
@@ -1087,9 +1126,13 @@ H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo /*out*/, unsigned fields)
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "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 = fields;
+
/* Retrieve the object's information */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- oinfo, fields) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
@@ -1113,8 +1156,9 @@ H5O__get_info_by_name_api_common(hid_t loc_id, const char *name, H5O_info2_t *oi
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 */
- H5VL_loc_params_t loc_params; /* Location parameters for object access */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -1126,12 +1170,16 @@ H5O__get_info_by_name_api_common(hid_t loc_id, const char *name, H5O_info2_t *oi
/* "name" is checked in H5VL_setup_name_args() */
/* Set up object access arguments */
- if (H5VL_setup_name_args(loc_id, name, H5P_CLS_LACC, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, vol_obj_ptr, &loc_params) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set object access arguments")
+ /* 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 = fields;
+
/* Retrieve the object's information */
- if (H5VL_object_get(*vol_obj_ptr, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, token_ptr,
- oinfo, fields) < 0)
+ if (H5VL_object_get(*vol_obj_ptr, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, token_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
@@ -1228,9 +1276,10 @@ herr_t
H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5O_info2_t *oinfo /*out*/, unsigned fields, hid_t lapl_id)
{
- 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_object_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)
H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id);
@@ -1251,6 +1300,7 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set location struct fields */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1263,9 +1313,13 @@ H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index_t idx_type, H
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "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 = fields;
+
/* Retrieve the object's information */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- oinfo, fields) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
done:
@@ -1287,9 +1341,11 @@ done:
herr_t
H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fields)
{
- 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", "ixIu", loc_id, oinfo, fields);
@@ -1308,9 +1364,15 @@ H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo /*out*/, unsigned fiel
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.get_native_info.fields = fields;
+ obj_opt_args.get_native_info.ninfo = oinfo;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object")
done:
@@ -1333,9 +1395,11 @@ herr_t
H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oinfo /*out*/, unsigned fields,
hid_t lapl_id)
{
- 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)
H5TRACE5("e", "i*sxIui", loc_id, name, oinfo, fields, lapl_id);
@@ -1364,9 +1428,15 @@ H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_native_info_t *oi
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.get_native_info.fields = fields;
+ obj_opt_args.get_native_info.ninfo = oinfo;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object: '%s'", name)
done:
@@ -1391,9 +1461,11 @@ herr_t
H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5_iter_order_t order,
hsize_t n, H5O_native_info_t *oinfo /*out*/, unsigned fields, hid_t lapl_id)
{
- 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)
H5TRACE8("e", "i*sIiIohxIui", loc_id, group_name, idx_type, order, n, oinfo, fields, lapl_id);
@@ -1414,6 +1486,7 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t
if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, FALSE) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSET, FAIL, "can't set access property list info")
+ /* Set location struct fields */
loc_params.type = H5VL_OBJECT_BY_IDX;
loc_params.loc_data.loc_by_idx.name = group_name;
loc_params.loc_data.loc_by_idx.idx_type = idx_type;
@@ -1426,9 +1499,15 @@ H5Oget_native_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_t
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.get_native_info.fields = fields;
+ obj_opt_args.get_native_info.ninfo = oinfo;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
+
/* Retrieve the object's information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, oinfo, fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native file format info for object")
done:
@@ -1455,9 +1534,11 @@ done:
herr_t
H5Oset_comment(hid_t obj_id, 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)
H5TRACE2("e", "i*s", obj_id, comment);
@@ -1474,9 +1555,14 @@ H5Oset_comment(hid_t obj_id, const char *comment)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
+ /* 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;
+
/* (Re)set the object's 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_OHDR, H5E_CANTSET, FAIL, "can't set comment for object")
done:
@@ -1503,9 +1589,11 @@ done:
herr_t
H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_t lapl_id)
{
- 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)
H5TRACE4("e", "i*s*si", loc_id, name, comment, lapl_id);
@@ -1528,9 +1616,14 @@ H5Oset_comment_by_name(hid_t loc_id, const char *name, const char *comment, hid_
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;
+
/* (Re)set the object's 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_OHDR, H5E_CANTSET, FAIL, "can't set comment for object: '%s'", name)
done:
@@ -1556,9 +1649,12 @@ done:
ssize_t
H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* 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 string */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE3("Zs", "ixz", obj_id, comment, bufsize);
@@ -1571,11 +1667,21 @@ H5Oget_comment(hid_t obj_id, char *comment /*out*/, size_t bufsize)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_comment.buf = comment;
+ 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;
+
/* Retrieve the object's comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object")
+ /* Set return value */
+ ret_value = (ssize_t)comment_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_comment() */
@@ -1599,9 +1705,12 @@ done:
ssize_t
H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, size_t bufsize, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- ssize_t ret_value = -1; /* 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 string */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE5("Zs", "i*sxzi", loc_id, name, comment, bufsize, lapl_id);
@@ -1624,11 +1733,21 @@ H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comment /*out*/, si
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 = comment;
+ 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;
+
/* Retrieve the object's comment */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_COMMENT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, comment, bufsize, &ret_value) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, (-1), "can't get comment for object: '%s'", name)
+ /* Set return value */
+ ret_value = (ssize_t)comment_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Oget_comment_by_name() */
@@ -1672,9 +1791,10 @@ herr_t
H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2_t op, void *op_data,
unsigned fields)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIoOI*xIu", obj_id, idx_type, order, op, op_data, fields);
@@ -1697,10 +1817,17 @@ H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate2
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(obj_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = op;
+ vol_cb_args.args.visit.op_data = op_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, fields)) <
- 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1746,9 +1873,10 @@ herr_t
H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate2_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIoOI*xIui", loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id);
@@ -1781,10 +1909,17 @@ H5Ovisit_by_name3(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
loc_params.loc_data.loc_by_name.lapl_id = lapl_id;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = op;
+ vol_cb_args.args.visit.op_data = op_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, op, op_data, fields)) <
- 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1792,23 +1927,23 @@ done:
} /* end H5Ovisit_by_name3() */
/*-------------------------------------------------------------------------
- * Function: H5O__close_check_common
+ * Function: H5O__close_check_type
*
* Purpose: This is the common function to validate an object
- * when closing it.
+ * before closing it.
*
* Return: TRUE/FALSE/FAIL
*
*-------------------------------------------------------------------------
*/
static htri_t
-H5O__close_check_common(hid_t object_id)
+H5O__close_check_type(hid_t object_id)
{
htri_t ret_value = TRUE; /* Return value */
FUNC_ENTER_STATIC
- /* Get the type of the object and close it in the correct way */
+ /* Check for closeable object */
switch (H5I_get_type(object_id)) {
case H5I_GROUP:
case H5I_DATATYPE:
@@ -1834,14 +1969,13 @@ H5O__close_check_common(hid_t object_id)
case H5I_EVENTSET:
case H5I_NTYPES:
default:
- HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FALSE,
- "not a valid file object ID (dataset, group, or datatype)")
+ HGOTO_DONE(FALSE);
break;
} /* end switch */
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O__close_check_common() */
+} /* H5O__close_check_type() */
/*-------------------------------------------------------------------------
* Function: H5Oclose
@@ -1869,7 +2003,7 @@ H5Oclose(hid_t object_id)
H5TRACE1("e", "i", object_id);
/* Validate the object type before closing */
- if (H5O__close_check_common(object_id) <= 0)
+ if (H5O__close_check_type(object_id) <= 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object")
if (H5I_dec_app_ref(object_id) < 0)
@@ -1901,7 +2035,7 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi
H5TRACE5("e", "*s*sIuii", app_file, app_func, app_line, object_id, es_id);
/* Validate the object type before closing */
- if (H5O__close_check_common(object_id) <= 0)
+ if (H5O__close_check_type(object_id) <= 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTRELEASE, FAIL, "not a valid object")
/* Prepare for possible asynchronous operation */
@@ -1941,7 +2075,7 @@ done:
} /* end H5Oclose_async() */
/*-------------------------------------------------------------------------
- * Function: H5O_disable_mdc_flushes
+ * Function: H5O__disable_mdc_flushes
*
* Purpose: Private version of the metadata cache cork function.
*
@@ -1950,18 +2084,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_disable_mdc_flushes(H5O_loc_t *oloc)
+H5O__disable_mdc_flushes(H5O_loc_t *oloc)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
if (H5AC_cork(oloc->file, oloc->addr, H5AC__SET_CORK, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object");
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5O_disable_mdc_flushes() */
+} /* H5O__disable_mdc_flushes() */
/*-------------------------------------------------------------------------
* Function: H5Odisable_mdc_flushes
@@ -1980,9 +2114,10 @@ done:
herr_t
H5Odisable_mdc_flushes(hid_t object_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- 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_loc_params_t loc_params; /* Location parameters */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE1("e", "i", object_id);
@@ -1999,9 +2134,13 @@ H5Odisable_mdc_flushes(hid_t object_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(object_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES;
+ vol_cb_args.args = NULL;
+
/* Cork the object */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork object");
done:
@@ -2009,7 +2148,7 @@ done:
} /* H5Odisable_mdc_flushes() */
/*-------------------------------------------------------------------------
- * Function: H5O_enable_mdc_flushes
+ * Function: H5O__enable_mdc_flushes
*
* Purpose: Private version of the metadata cache uncork function.
*
@@ -2018,18 +2157,18 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_enable_mdc_flushes(H5O_loc_t *oloc)
+H5O__enable_mdc_flushes(H5O_loc_t *oloc)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
if (H5AC_cork(oloc->file, oloc->addr, H5AC__UNCORK, NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object");
done:
FUNC_LEAVE_NOAPI(ret_value);
-} /* H5O_enable_mdc_flushes() */
+} /* H5O__enable_mdc_flushes() */
/*-------------------------------------------------------------------------
* Function: H5Oenable_mdc_flushes
@@ -2048,9 +2187,10 @@ done:
herr_t
H5Oenable_mdc_flushes(hid_t object_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- 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_loc_params_t loc_params; /* Location parameters */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE1("e", "i", object_id);
@@ -2067,9 +2207,13 @@ H5Oenable_mdc_flushes(hid_t object_id)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(object_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES;
+ vol_cb_args.args = NULL;
+
/* Uncork the object */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork object");
done:
@@ -2077,7 +2221,7 @@ done:
} /* H5Oenable_mdc_flushes() */
/*-------------------------------------------------------------------------
- * Function: H5O_are_mdc_flushes_disabled
+ * Function: H5O__are_mdc_flushes_disabled
*
* Purpose: Private version of cork status getter.
*
@@ -2086,11 +2230,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled)
+H5O__are_mdc_flushes_disabled(const H5O_loc_t *oloc, hbool_t *are_disabled)
{
herr_t ret_value = SUCCEED;
- FUNC_ENTER_NOAPI(FAIL);
+ FUNC_ENTER_PACKAGE
HDassert(are_disabled);
@@ -2099,7 +2243,7 @@ H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* H5O_are_mdc_flushes_disabled() */
+} /* H5O__are_mdc_flushes_disabled() */
/*-------------------------------------------------------------------------
* Function: H5Oare_mdc_flushes_disabled
@@ -2121,9 +2265,11 @@ done:
herr_t
H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- 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; /* Location parameters */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL);
H5TRACE2("e", "i*b", object_id, are_disabled);
@@ -2144,9 +2290,14 @@ H5Oare_mdc_flushes_disabled(hid_t object_id, hbool_t *are_disabled)
loc_params.type = H5VL_OBJECT_BY_SELF;
loc_params.obj_type = H5I_get_type(object_id);
+ /* Set up VOL callback arguments */
+ obj_opt_args.are_mdc_flushes_disabled.flag = are_disabled;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED;
+ vol_cb_args.args = &obj_opt_args;
+
/* Get the cork status */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, are_disabled) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) <
+ 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to retrieve object's cork status");
done:
diff --git a/src/H5Ocache.c b/src/H5Ocache.c
index a968f84..8eed092 100644
--- a/src/H5Ocache.c
+++ b/src/H5Ocache.c
@@ -78,8 +78,8 @@ static herr_t H5O__cache_chk_free_icr(void *thing);
static herr_t H5O__prefix_deserialize(const uint8_t *image, H5O_cache_ud_t *udata);
/* Chunk routines */
-static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
- H5O_common_cache_ud_t *udata, hbool_t *dirty);
+static herr_t H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t *image,
+ size_t len, H5O_common_cache_ud_t *udata, hbool_t *dirty);
static herr_t H5O__chunk_serialize(const H5F_t *f, H5O_t *oh, unsigned chunkno);
/* Misc. routines */
@@ -289,7 +289,7 @@ H5O__cache_verify_chksum(const void *_image, size_t len, void *_udata)
*-------------------------------------------------------------------------
*/
static void *
-H5O__cache_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty)
+H5O__cache_deserialize(const void *image, size_t len, void *_udata, hbool_t *dirty)
{
H5O_t * oh = NULL; /* Object header read in */
H5O_cache_ud_t *udata = (H5O_cache_ud_t *)_udata; /* User data for callback */
@@ -335,7 +335,7 @@ H5O__cache_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void
oh->proxy = NULL;
/* Parse the first chunk */
- if (H5O__chunk_deserialize(oh, udata->common.addr, udata->chunk0_size, (const uint8_t *)image,
+ if (H5O__chunk_deserialize(oh, udata->common.addr, udata->chunk0_size, (const uint8_t *)image, len,
&(udata->common), dirty) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize first object header chunk")
@@ -738,7 +738,7 @@ H5O__cache_chk_verify_chksum(const void *_image, size_t len, void *_udata)
*-------------------------------------------------------------------------
*/
static void *
-H5O__cache_chk_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len, void *_udata, hbool_t *dirty)
+H5O__cache_chk_deserialize(const void *image, size_t len, void *_udata, hbool_t *dirty)
{
H5O_chunk_proxy_t * chk_proxy = NULL; /* Chunk proxy object */
H5O_chk_cache_ud_t *udata = (H5O_chk_cache_ud_t *)_udata; /* User data for callback */
@@ -765,7 +765,7 @@ H5O__cache_chk_deserialize(const void *image, size_t H5_ATTR_NDEBUG_UNUSED len,
HDassert(udata->common.cont_msg_info);
/* Parse the chunk */
- if (H5O__chunk_deserialize(udata->oh, udata->common.addr, udata->size, (const uint8_t *)image,
+ if (H5O__chunk_deserialize(udata->oh, udata->common.addr, udata->size, (const uint8_t *)image, len,
&(udata->common), dirty) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, NULL, "can't deserialize object header chunk")
@@ -1277,7 +1277,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image,
+H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t chunk_size, const uint8_t *image, size_t len,
H5O_common_cache_ud_t *udata, hbool_t *dirty)
{
const uint8_t *chunk_image; /* Pointer into buffer to decode */
@@ -1297,6 +1297,7 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
HDassert(oh);
HDassert(H5F_addr_defined(addr));
HDassert(image);
+ HDassert(len);
HDassert(udata->f);
HDassert(udata->cont_msg_info);
@@ -1317,14 +1318,16 @@ H5O__chunk_deserialize(H5O_t *oh, haddr_t addr, size_t len, const uint8_t *image
oh->chunk[chunkno].addr = addr;
if (chunkno == 0)
/* First chunk's 'image' includes room for the object header prefix */
- oh->chunk[0].size = len + (size_t)H5O_SIZEOF_HDR(oh);
+ oh->chunk[0].size = chunk_size + (size_t)H5O_SIZEOF_HDR(oh);
else
- oh->chunk[chunkno].size = len;
+ oh->chunk[chunkno].size = chunk_size;
if (NULL == (oh->chunk[chunkno].image = H5FL_BLK_MALLOC(chunk_image, oh->chunk[chunkno].size)))
HGOTO_ERROR(H5E_OHDR, H5E_CANTALLOC, FAIL, "memory allocation failed")
oh->chunk[chunkno].chunk_proxy = NULL;
/* Copy disk image into chunk's image */
+ if (len < oh->chunk[chunkno].size)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTCOPY, FAIL, "attempted to copy too many disk image bytes into buffer")
H5MM_memcpy(oh->chunk[chunkno].image, image, oh->chunk[chunkno].size);
/* Point into chunk image to decode */
diff --git a/src/H5Odeprec.c b/src/H5Odeprec.c
index 5e13f9f..7def20a 100644
--- a/src/H5Odeprec.c
+++ b/src/H5Odeprec.c
@@ -122,8 +122,6 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
H5O_info1_t oinfo; /* Deprecated object info struct */
unsigned dm_fields; /* Fields for data model query */
unsigned nat_fields; /* Fields for native query */
- H5VL_object_t * vol_obj; /* Object of obj_id */
- H5VL_loc_params_t loc_params; /* Location parameters for VOL callback */
herr_t ret_value = H5_ITER_CONT; /* Return value */
FUNC_ENTER_STATIC
@@ -160,24 +158,34 @@ H5O__iterate1_adapter(hid_t obj_id, const char *name, const H5O_info2_t *oinfo2,
oinfo.num_attrs = oinfo2->num_attrs;
}
- /* 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(obj_id);
-
- /* Get the location object */
- if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
- HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
-
/* Check for retrieving native information */
nat_fields = shim_data->fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE);
if (nat_fields) {
- H5O_native_info_t nat_info; /* Native object info */
+ H5VL_object_t * vol_obj; /* Object of obj_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; /* Location parameters for VOL callback */
+ H5O_native_info_t nat_info; /* Native 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(obj_id);
+
+ /* Get the location object */
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, H5_ITER_ERROR, "invalid location identifier")
+
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_native_info.fields = nat_fields;
+ obj_opt_args.get_native_info.ninfo = &nat_info;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
/* Retrieve the object's native information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &loc_params, &nat_info, nat_fields) < 0)
+ if (H5VL_object_optional(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object")
/* Set the native fields */
@@ -228,11 +236,16 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf
/* Check for retrieving data model information */
dm_fields = fields & (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS);
if (dm_fields) {
- H5O_info2_t dm_info; /* Data model object info */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5O_info2_t dm_info; /* Data model object info */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_INFO;
+ vol_cb_args.args.get_info.oinfo = &dm_info;
+ vol_cb_args.args.get_info.fields = dm_fields;
/* Retrieve the object's data model information */
- if (H5VL_object_get(vol_obj, loc_params, H5VL_OBJECT_GET_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &dm_info, dm_fields) < 0)
+ if (H5VL_object_get(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get data model info for object")
/* Set the data model fields */
@@ -265,11 +278,19 @@ H5O__get_info_old(H5VL_object_t *vol_obj, H5VL_loc_params_t *loc_params, H5O_inf
/* Check for retrieving native information */
nat_fields = fields & (H5O_INFO_HDR | H5O_INFO_META_SIZE);
if (nat_fields) {
- H5O_native_info_t nat_info; /* Native object info */
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_native_object_optional_args_t obj_opt_args; /* Arguments for optional operation */
+ H5O_native_info_t nat_info; /* Native object info */
+
+ /* Set up VOL callback arguments */
+ obj_opt_args.get_native_info.fields = nat_fields;
+ obj_opt_args.get_native_info.ninfo = &nat_info;
+ vol_cb_args.op_type = H5VL_NATIVE_OBJECT_GET_NATIVE_INFO;
+ vol_cb_args.args = &obj_opt_args;
/* Retrieve the object's native information */
- if (H5VL_object_optional(vol_obj, H5VL_NATIVE_OBJECT_GET_NATIVE_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, loc_params, &nat_info, nat_fields) < 0)
+ if (H5VL_object_optional(vol_obj, loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get native info for object")
/* Set the native fields */
@@ -751,10 +772,11 @@ done:
herr_t
H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "iIiIoOi*x", obj_id, idx_type, order, op, op_data);
@@ -780,10 +802,17 @@ H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1
shim_data.fields = H5O_INFO_ALL;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = H5O_INFO_ALL;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, H5O_INFO_ALL)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -826,10 +855,11 @@ herr_t
H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate1_t op, void *op_data, hid_t lapl_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE7("e", "i*sIiIoOi*xi", loc_id, obj_name, idx_type, order, op, op_data, lapl_id);
@@ -865,10 +895,17 @@ H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
shim_data.fields = H5O_INFO_ALL;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = H5O_INFO_ALL;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, H5O_INFO_ALL)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
done:
@@ -914,11 +951,12 @@ herr_t
H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1_t op, void *op_data,
unsigned fields)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE6("e", "iIiIoOi*xIu", obj_id, idx_type, order, op, op_data, fields);
@@ -954,10 +992,17 @@ H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order, H5O_iterate1
shim_data.fields = fields;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, fields)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
@@ -1003,11 +1048,12 @@ herr_t
H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_iter_order_t order,
H5O_iterate1_t op, void *op_data, unsigned fields, hid_t lapl_id)
{
- H5VL_object_t * vol_obj; /* Object of loc_id */
- H5VL_loc_params_t loc_params;
- H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
- hbool_t is_native_vol_obj;
- herr_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_object_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5O_visit1_adapter_t shim_data; /* Adapter for passing app callback & user data */
+ hbool_t is_native_vol_obj;
+ herr_t ret_value; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE8("e", "i*sIiIoOi*xIui", loc_id, obj_name, idx_type, order, op, op_data, fields, lapl_id);
@@ -1053,10 +1099,17 @@ H5Ovisit_by_name2(hid_t loc_id, const char *obj_name, H5_index_t idx_type, H5_it
shim_data.fields = fields;
shim_data.real_op_data = op_data;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_VISIT;
+ vol_cb_args.args.visit.idx_type = idx_type;
+ vol_cb_args.args.visit.order = order;
+ vol_cb_args.args.visit.op = H5O__iterate1_adapter;
+ vol_cb_args.args.visit.op_data = &shim_data;
+ vol_cb_args.args.visit.fields = fields;
+
/* Visit the objects */
- if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_VISIT, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, (int)idx_type, (int)order, H5O__iterate1_adapter,
- (void *)&shim_data, fields)) < 0)
+ if ((ret_value = H5VL_object_specific(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object iteration failed")
done:
diff --git a/src/H5Oflush.c b/src/H5Oflush.c
index 2e3c1fd..f2eacd6 100644
--- a/src/H5Oflush.c
+++ b/src/H5Oflush.c
@@ -49,7 +49,7 @@
/* Local Prototypes */
/********************/
static herr_t H5O__oh_tag(const H5O_loc_t *oloc, haddr_t *tag);
-static herr_t H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc);
+static herr_t H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid);
/*************/
/* Functions */
@@ -194,7 +194,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
+H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid)
{
hbool_t objs_incr = FALSE; /* Whether the object count in the file was incremented */
herr_t ret_value = SUCCEED; /* Return value */
@@ -202,7 +202,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
FUNC_ENTER_NOAPI(FAIL)
/* If the file is opened with write access, no need to perform refresh actions. */
- if (!(H5F_INTENT(oloc.file) & H5F_ACC_RDWR)) {
+ if (!(H5F_INTENT(oloc->file) & H5F_ACC_RDWR)) {
H5G_loc_t obj_loc;
H5O_loc_t obj_oloc;
H5G_name_t obj_path;
@@ -219,7 +219,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
/* "Fake" another open object in the file, so that it doesn't get closed
* if this object is the only thing holding the file open.
*/
- H5F_incr_nopen_objs(oloc.file);
+ H5F_incr_nopen_objs(oloc->file);
objs_incr = TRUE;
/* Get the VOL object from the ID and cache a pointer to the connector.
@@ -252,7 +252,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
connector->nrefs++;
/* Close object & evict its metadata */
- if ((H5O__refresh_metadata_close(oid, oloc, &obj_loc)) < 0)
+ if (H5O__refresh_metadata_close(oloc, &obj_loc, oid) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
/* Re-open the object, re-fetching its metadata */
@@ -280,7 +280,7 @@ H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc)
done:
if (objs_incr)
- H5F_decr_nopen_objs(oloc.file);
+ H5F_decr_nopen_objs(oloc->file);
FUNC_LEAVE_NOAPI(ret_value);
} /* end H5O_refresh_metadata() */
@@ -305,8 +305,9 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
+H5O__refresh_metadata_close(H5O_loc_t *oloc, H5G_loc_t *obj_loc, hid_t oid)
{
+ H5F_t * file; /* Local copy of the object's file pointer */
haddr_t tag = 0; /* Tag for object */
hbool_t corked = FALSE; /* Whether object's metadata is corked */
herr_t ret_value = SUCCEED; /* Return value */
@@ -327,28 +328,32 @@ H5O__refresh_metadata_close(hid_t oid, H5O_loc_t oloc, H5G_loc_t *obj_loc)
HGOTO_ERROR(H5E_OHDR, H5E_CANTOPENOBJ, FAIL, "unable to prepare refresh for dataset")
/* Retrieve tag for object */
- if (H5O__oh_tag(&oloc, &tag) < 0)
+ if (H5O__oh_tag(oloc, &tag) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to get object header address")
/* Get cork status of the object with tag */
- if (H5AC_cork(oloc.file, tag, H5AC__GET_CORKED, &corked) < 0)
+ if (H5AC_cork(oloc->file, tag, H5AC__GET_CORKED, &corked) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to retrieve an object's cork status")
+ /* Hold a copy of the object's file pointer, since closing the object will
+ * invalidate the file pointer in the oloc.
+ */
+ file = oloc->file;
/* Close the object */
if (H5I_dec_ref(oid) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to close object")
/* Flush metadata based on tag value of the object */
- if (H5F_flush_tagged_metadata(oloc.file, tag) < 0)
+ if (H5F_flush_tagged_metadata(file, tag) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush tagged metadata")
/* Evict the object's tagged metadata */
- if (H5F_evict_tagged_metadata(oloc.file, tag) < 0)
+ if (H5F_evict_tagged_metadata(file, tag) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to evict metadata")
/* Re-cork object with tag */
if (corked)
- if (H5AC_cork(oloc.file, tag, H5AC__SET_CORK, &corked) < 0)
+ if (H5AC_cork(file, tag, H5AC__SET_CORK, &corked) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_SYSTEM, FAIL, "unable to cork the object")
done:
diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c
index 44c4985..b60f589 100644
--- a/src/H5Ofsinfo.c
+++ b/src/H5Ofsinfo.c
@@ -91,11 +91,12 @@ H5FL_DEFINE_STATIC(H5O_fsinfo_t);
*/
static void *
H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNUSED mesg_flags,
- unsigned H5_ATTR_UNUSED *ioflags, size_t H5_ATTR_UNUSED p_size, const uint8_t *p)
+ unsigned H5_ATTR_UNUSED *ioflags, size_t p_size, const uint8_t *p)
{
- H5O_fsinfo_t * fsinfo = NULL; /* File space info message */
- H5F_mem_page_t ptype; /* Memory type for iteration */
- unsigned vers; /* message version */
+ H5O_fsinfo_t * fsinfo = NULL; /* File space info message */
+ H5F_mem_page_t ptype; /* Memory type for iteration */
+ unsigned vers; /* message version */
+ const uint8_t *p_end = p + p_size;
void * ret_value = NULL; /* Return value */
FUNC_ENTER_STATIC
@@ -136,8 +137,12 @@ H5O__fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, unsigned H5_ATTR_UNU
fsinfo->threshold = threshold;
if (HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)))
HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size")
- for (type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++)
+ for (type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) {
+ if (p + H5_SIZEOF_HADDR_T > p_end)
+ HGOTO_ERROR(H5E_FILE, H5E_CANTDECODE, NULL,
+ "ran off end of input buffer while decoding")
H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type - 1]));
+ }
break;
case H5F_FILE_SPACE_ALL:
diff --git a/src/H5Omodule.h b/src/H5Omodule.h
index 134aa92..8afba29 100644
--- a/src/H5Omodule.h
+++ b/src/H5Omodule.h
@@ -30,9 +30,46 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5O H5O
- * \brief Object Interface
*
- * \todo Describe concisely what the functions in this module are about.
+ * Use the functions in this module to manage HDF5 objects.
+ *
+ * HDF5 objects (groups, datasets, datatype objects) are usually created
+ * using functions in the object-specific modules (\ref H5G, \ref H5D,
+ * \ref H5T). However, new objects can also be created by copying existing
+ * objects.
+ *
+ * Many functions in this module are variations on object introspection,
+ * that is, the retrieval of detailed information about HDF5 objects in a file.
+ * Objects in an HDF5 file can be "visited" in an iterative fashion.
+ *
+ * HDF5 objects are usually updated using functions in the object-specific
+ * modules. However, there are certain generic object properties, such as
+ * reference counts, that can be manipulated using functions in this module.
+ *
+ * HDF5 objects are deleted as a side effect of rendering them unreachable
+ * from the root group. The net effect is the diminution of the object's
+ * reference count to zero, which can (but should not usually) be effected
+ * by a function in this module.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5O_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5O_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5O_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5O_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
*/
#endif /* H5Omodule_H */
diff --git a/src/H5Opkg.h b/src/H5Opkg.h
index 6e203bb..331fcf6 100644
--- a/src/H5Opkg.h
+++ b/src/H5Opkg.h
@@ -581,6 +581,11 @@ H5_DLL herr_t H5O__chunk_resize(H5O_t *oh, H5O_chunk_proxy_t *chk_pr
H5_DLL herr_t H5O__chunk_delete(H5F_t *f, H5O_t *oh, unsigned idx);
H5_DLL herr_t H5O__chunk_dest(H5O_chunk_proxy_t *chunk_proxy);
+/* Cache corking functions */
+H5_DLL herr_t H5O__disable_mdc_flushes(H5O_loc_t *oloc);
+H5_DLL herr_t H5O__enable_mdc_flushes(H5O_loc_t *oloc);
+H5_DLL herr_t H5O__are_mdc_flushes_disabled(const H5O_loc_t *oloc, hbool_t *are_disabled);
+
/* Collect storage info for btree and heap */
H5_DLL herr_t H5O__attr_bh_info(H5F_t *f, H5O_t *oh, H5_ih_info_t *bh_info);
diff --git a/src/H5Oprivate.h b/src/H5Oprivate.h
index d3b469c..72306df 100644
--- a/src/H5Oprivate.h
+++ b/src/H5Oprivate.h
@@ -990,13 +990,9 @@ H5_DLL herr_t H5O_msg_get_flags(const H5O_loc_t *loc, unsigned type_id, uint8_t
/* Object metadata flush/refresh routines */
H5_DLL herr_t H5O_flush(H5O_loc_t *oloc, hid_t obj_id);
H5_DLL herr_t H5O_flush_common(H5O_loc_t *oloc, hid_t obj_id);
-H5_DLL herr_t H5O_refresh_metadata(hid_t oid, H5O_loc_t oloc);
-H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t, H5G_loc_t *, const H5O_refresh_state_t *, H5VL_t *, hbool_t);
-
-/* Cache corking functions */
-H5_DLL herr_t H5O_disable_mdc_flushes(H5O_loc_t *oloc);
-H5_DLL herr_t H5O_enable_mdc_flushes(H5O_loc_t *oloc);
-H5_DLL herr_t H5O_are_mdc_flushes_disabled(H5O_loc_t *oloc, hbool_t *are_disabled);
+H5_DLL herr_t H5O_refresh_metadata(H5O_loc_t *oloc, hid_t oid);
+H5_DLL herr_t H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, const H5O_refresh_state_t *state,
+ H5VL_t *vol_driver, hbool_t start_swmr);
/* Object copying routines */
H5_DLL herr_t H5O_copy_header_map(const H5O_loc_t *oloc_src, H5O_loc_t *oloc_dst /*out */,
diff --git a/src/H5Opublic.h b/src/H5Opublic.h
index 7bc7784..d9d0500 100644
--- a/src/H5Opublic.h
+++ b/src/H5Opublic.h
@@ -35,14 +35,14 @@
/*****************/
/* Flags for object copy (H5Ocopy) */
-#define H5O_COPY_SHALLOW_HIERARCHY_FLAG (0x0001u) /* Copy only immediate members */
-#define H5O_COPY_EXPAND_SOFT_LINK_FLAG (0x0002u) /* Expand soft links into new objects */
-#define H5O_COPY_EXPAND_EXT_LINK_FLAG (0x0004u) /* Expand external links into new objects */
-#define H5O_COPY_EXPAND_REFERENCE_FLAG (0x0008u) /* Copy objects that are pointed by references */
-#define H5O_COPY_WITHOUT_ATTR_FLAG (0x0010u) /* Copy object without copying attributes */
-#define H5O_COPY_PRESERVE_NULL_FLAG (0x0020u) /* Copy NULL messages (empty space) */
-#define H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG (0x0040u) /* Merge committed datatypes in dest file */
-#define H5O_COPY_ALL (0x007Fu) /* All object copying flags (for internal checking) */
+#define H5O_COPY_SHALLOW_HIERARCHY_FLAG (0x0001u) /**< Copy only immediate members */
+#define H5O_COPY_EXPAND_SOFT_LINK_FLAG (0x0002u) /**< Expand soft links into new objects */
+#define H5O_COPY_EXPAND_EXT_LINK_FLAG (0x0004u) /**< Expand external links into new objects */
+#define H5O_COPY_EXPAND_REFERENCE_FLAG (0x0008u) /**< Copy objects that are pointed by references */
+#define H5O_COPY_WITHOUT_ATTR_FLAG (0x0010u) /**< Copy object without copying attributes */
+#define H5O_COPY_PRESERVE_NULL_FLAG (0x0020u) /**< Copy NULL messages (empty space) */
+#define H5O_COPY_MERGE_COMMITTED_DTYPE_FLAG (0x0040u) /**< Merge committed datatypes in dest file */
+#define H5O_COPY_ALL (0x007Fu) /**< All object copying flags (for internal checking) */
/* Flags for shared message indexes.
* Pass these flags in using the mesg_type_flags parameter in
@@ -51,25 +51,27 @@
* but we need to assign each kind of message to a different bit so that
* one index can hold multiple types.)
*/
-#define H5O_SHMESG_NONE_FLAG 0x0000 /* No shared messages */
-#define H5O_SHMESG_SDSPACE_FLAG ((unsigned)1 << 0x0001) /* Simple Dataspace Message. */
-#define H5O_SHMESG_DTYPE_FLAG ((unsigned)1 << 0x0003) /* Datatype Message. */
-#define H5O_SHMESG_FILL_FLAG ((unsigned)1 << 0x0005) /* Fill Value Message. */
-#define H5O_SHMESG_PLINE_FLAG ((unsigned)1 << 0x000b) /* Filter pipeline message. */
-#define H5O_SHMESG_ATTR_FLAG ((unsigned)1 << 0x000c) /* Attribute Message. */
+#define H5O_SHMESG_NONE_FLAG 0x0000 /**< No shared messages */
+#define H5O_SHMESG_SDSPACE_FLAG ((unsigned)1 << 0x0001) /**< Simple Dataspace Message. */
+#define H5O_SHMESG_DTYPE_FLAG ((unsigned)1 << 0x0003) /**< Datatype Message. */
+#define H5O_SHMESG_FILL_FLAG ((unsigned)1 << 0x0005) /**< Fill Value Message. */
+#define H5O_SHMESG_PLINE_FLAG ((unsigned)1 << 0x000b) /**< Filter pipeline message. */
+#define H5O_SHMESG_ATTR_FLAG ((unsigned)1 << 0x000c) /**< Attribute Message. */
#define H5O_SHMESG_ALL_FLAG \
(H5O_SHMESG_SDSPACE_FLAG | H5O_SHMESG_DTYPE_FLAG | H5O_SHMESG_FILL_FLAG | H5O_SHMESG_PLINE_FLAG | \
H5O_SHMESG_ATTR_FLAG)
+/* clang-format off */
/* Object header status flag definitions */
-#define H5O_HDR_CHUNK0_SIZE 0x03 /* 2-bit field indicating # of bytes to store the size of chunk 0's data */
-#define H5O_HDR_ATTR_CRT_ORDER_TRACKED 0x04 /* Attribute creation order is tracked */
-#define H5O_HDR_ATTR_CRT_ORDER_INDEXED 0x08 /* Attribute creation order has index */
-#define H5O_HDR_ATTR_STORE_PHASE_CHANGE 0x10 /* Non-default attribute storage phase change values stored */
-#define H5O_HDR_STORE_TIMES 0x20 /* Store access, modification, change & birth times for object */
+#define H5O_HDR_CHUNK0_SIZE 0x03 /**< 2-bit field indicating # of bytes to store the size of chunk 0's data */
+#define H5O_HDR_ATTR_CRT_ORDER_TRACKED 0x04 /**< Attribute creation order is tracked */
+#define H5O_HDR_ATTR_CRT_ORDER_INDEXED 0x08 /**< Attribute creation order has index */
+#define H5O_HDR_ATTR_STORE_PHASE_CHANGE 0x10 /**< Non-default attribute storage phase change values stored */
+#define H5O_HDR_STORE_TIMES 0x20 /**< Store access, modification, change & birth times for object */
#define H5O_HDR_ALL_FLAGS \
(H5O_HDR_CHUNK0_SIZE | H5O_HDR_ATTR_CRT_ORDER_TRACKED | H5O_HDR_ATTR_CRT_ORDER_INDEXED | \
H5O_HDR_ATTR_STORE_PHASE_CHANGE | H5O_HDR_STORE_TIMES)
+/* clang-format on */
/* Maximum shared message values. Number of indexes is 8 to allow room to add
* new types of messages.
@@ -81,9 +83,9 @@
* Theses flags determine which fields will be filled in in the H5O_info_t
* struct.
*/
-#define H5O_INFO_BASIC 0x0001u /* Fill in the fileno, addr, type, and rc fields */
-#define H5O_INFO_TIME 0x0002u /* Fill in the atime, mtime, ctime, and btime fields */
-#define H5O_INFO_NUM_ATTRS 0x0004u /* Fill in the num_attrs field */
+#define H5O_INFO_BASIC 0x0001u /**< Fill in the fileno, addr, type, and rc fields */
+#define H5O_INFO_TIME 0x0002u /**< Fill in the atime, mtime, ctime, and btime fields */
+#define H5O_INFO_NUM_ATTRS 0x0004u /**< Fill in the num_attrs field */
#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS)
//! <!-- [H5O_native_info_fields_snip] -->
@@ -91,8 +93,8 @@
* Flags for H5Oget_native_info(). Theses flags determine which fields will be
* filled in in the \ref H5O_native_info_t struct.
*/
-#define H5O_NATIVE_INFO_HDR 0x0008u /* Fill in the hdr field */
-#define H5O_NATIVE_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
+#define H5O_NATIVE_INFO_HDR 0x0008u /**< Fill in the hdr field */
+#define H5O_NATIVE_INFO_META_SIZE 0x0010u /**< Fill in the meta_size field */
#define H5O_NATIVE_INFO_ALL (H5O_NATIVE_INFO_HDR | H5O_NATIVE_INFO_META_SIZE)
//! <!-- [H5O_native_info_fields_snip] -->
@@ -146,15 +148,15 @@ typedef struct H5O_hdr_info_t {
* (For H5Oget_info(), H5Oget_info_by_name(), H5Oget_info_by_idx() version 3)
*/
typedef struct H5O_info2_t {
- unsigned long fileno; /* File number that object is located in */
- H5O_token_t token; /* Token representing the object */
- H5O_type_t type; /* Basic object type (group, dataset, etc.) */
- unsigned rc; /* Reference count of object */
- time_t atime; /* Access time */
- time_t mtime; /* Modification time */
- time_t ctime; /* Change time */
- time_t btime; /* Birth time */
- hsize_t num_attrs; /* # of attributes attached to object */
+ unsigned long fileno; /**< File number that object is located in */
+ H5O_token_t token; /**< Token representing the object */
+ H5O_type_t type; /**< Basic object type (group, dataset, etc.) */
+ unsigned rc; /**< Reference count of object */
+ time_t atime; /**< Access time */
+ time_t mtime; /**< Modification time */
+ time_t ctime; /**< Change time */
+ time_t btime; /**< Birth time */
+ hsize_t num_attrs; /**< Number of attributes attached to object */
} H5O_info2_t;
//! <!-- [H5O_info2_t_snip] -->
@@ -165,11 +167,10 @@ typedef struct H5O_info2_t {
*/
typedef struct H5O_native_info_t {
H5O_hdr_info_t hdr; /**< Object header information */
- /* Extra metadata storage for obj & attributes */
struct {
H5_ih_info_t obj; /**< v1/v2 B-tree & local/fractal heap for groups, B-tree for chunked datasets */
H5_ih_info_t attr; /**< v2 B-tree & heap for attributes */
- } meta_size;
+ } meta_size; /**< Extra metadata storage for obj & attributes */
} H5O_native_info_t;
//! <!-- [H5O_native_info_t_snip] -->
@@ -181,6 +182,17 @@ typedef uint32_t H5O_msg_crt_idx_t;
//! <!-- [H5O_iterate2_t_snip] -->
/**
* Prototype for H5Ovisit(), H5Ovisit_by_name() operator (version 3)
+ *
+ * \param[in] obj Object that serves as the root of the iteration;
+ * the same value as the H5Ovisit3() \c obj_id parameter
+ * \param[in] name Name of object, relative to \p obj, being examined at current
+ * step of the iteration
+ * \param[out] info Information about that object
+ * \param[in,out] op_data User-defined pointer to data required by the application
+ * in processing the object; a pass-through of the \c op_data
+ * pointer provided with the H5Ovisit3() function call
+ * \return \herr_t_iter
+ *
*/
typedef herr_t (*H5O_iterate2_t)(hid_t obj, const char *name, const H5O_info2_t *info, void *op_data);
//! <!-- [H5O_iterate2_t_snip] -->
@@ -460,28 +472,7 @@ H5_DLL htri_t H5Oexists_by_name(hid_t loc_id, const char *name, hid_t lapl_id);
* \return \herr_t
*
* \details H5Oget_info3() specifies an object by its identifier, \p loc_id , and
- * retrieves the metadata describing that object in \p oinfo , an H5O_info2_t \c struct.
- *
- * The H5O_info2_t \c struct is defined in H5Opublic.h as follows :
- * \snippet this H5O_info2_t_snip
- *
- * Note the following about H5O_info2_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- *
- * The H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by H5O_type_t.
+ * retrieves the metadata describing that object in \p oinfo.
*
* The \p fields parameter contains flags to determine which fields will be filled in
* the H5O_info2_t \c struct returned in \p oinfo.
@@ -530,29 +521,6 @@ H5_DLL herr_t H5Oget_info3(hid_t loc_id, H5O_info2_t *oinfo, unsigned fields);
* \p loc_id and \p name, respectively, and retrieves the metadata
* describing that object in \p oinfo, an H5O_info2_t struct.
*
- * \p oinfo, in which the object information is returned, is a \c struct of
- * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code:
- *
- * \snippet this H5O_info2_t_snip
- *
- * Note the following about H5O_info2_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- *
- * The H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by H5O_type_t.
- *
* The \p fields parameter contains flags to determine which fields will be filled in
* the H5O_info2_t \c struct returned in \p oinfo.
* These flags are defined in the H5Opublic.h file:
@@ -608,34 +576,6 @@ H5_DLL herr_t H5Oget_info_by_name_async(const char *app_file, const char *app_fu
* If \p loc_id fully specifies the group in which the object resides,
* \p group_name can be a dot (\c .).
*
- * \p idx_type is of type #H5_index_t, defined in H5public.h as:
- * \snippet H5public.h H5_index_t_snip
- *
- * \p order is of type #H5_iter_order_t defined in H5public.h as:
- * \snippet H5public.h H5_iter_order_t_snip
- *
- * \p oinfo, in which the object information is returned, is a \c struct of
- * type H5O_info2_t, which is defined in H5Opublic.h in the HDF5 source code:
- * \snippet this H5O_info2_t_snip
- *
- * Note the following about H5O_info2_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- *
- * H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The #H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by #H5O_type_t.
- *
* The \p fields parameter contains flags to determine which fields will be filled in
* the H5O_info2_t \c struct returned in \p oinfo.
* These flags are defined in the H5Opublic.h file:
@@ -668,11 +608,7 @@ H5_DLL herr_t H5Oget_info_by_idx3(hid_t loc_id, const char *group_name, H5_index
* \return \herr_t
*
* \details H5Oget_native_info() retrieves the native file format information for an object
- * specified by \p loc_id. The information is retrieved into the
- * buffer specified by \p oinfo, which is defined as a \c struct of
- * type H5O_native_info_t in H5Opublic.h:
- *
- * \snippet this H5O_native_info_t_snip
+ * specified by \p loc_id.
*
* The \p fields parameter indicates which fields to fill in
* H5O_native_info_t. Possible values defined in H5Opublic.h are:
@@ -703,12 +639,9 @@ H5_DLL herr_t H5Oget_native_info(hid_t loc_id, H5O_native_info_t *oinfo, unsigne
*
* \return \herr_t
*
- * \details H5Oget_native_info_by_name() retrieves the native file format information for an object
- * specified by \p loc_id and the name \p name. The information is
- * retrieved into the buffer specified by \p oinfo, which is defined
- * as a \c struct of type H5O_native_info_t in H5Opublic.h:
- *
- * \snippet this H5O_native_info_t_snip
+ * \details H5Oget_native_info_by_name() retrieves the native file format
+ * information for an object specified by \p loc_id and the name \p
+ * name.
*
* The \p fields parameter which fields to fill in H5O_native_info_t.
* Possible values defined in H5Opublic.h are:
@@ -747,16 +680,7 @@ H5_DLL herr_t H5Oget_native_info_by_name(hid_t loc_id, const char *name, H5O_nat
* specified by \p loc_id, group name, \p group_name, the index by which
* objects in the group are tracked, \p idx_type, the order by which
* the index is to be traversed, \p order , and an object's position
- * \p n within that index. The information is retrieved into the
- * buffer specified by \p oinfo, which is defined as a \c struct of
- * type H5O_native_info_t in H5Opublic.h:
- * \snippet this H5O_native_info_t_snip
- *
- * \p idx_type is of type #H5_index_t, defined in H5public.h as:
- * \snippet H5public.h H5_index_t_snip
- *
- * \p order is of type #H5_iter_order_t defined in H5public.h as:
- * \snippet H5public.h H5_iter_order_t_snip
+ * \p n within that index.
*
* The \p fields parameter indicates which fields to fill in H5O_native_info_t.
* Possible values defined in H5Opublic.h are:
@@ -1236,11 +1160,8 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
- *
+ * unnecessary, so the iteration may begin more quickly.
+
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in
* a value indicating iteration in creation order and a group is
@@ -1250,62 +1171,7 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate2_t_snip
- *
- * The parameters of this callback function have the following values
- * or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration;
- * same value as the H5Ovisit() \p obj_id parameter</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info2_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object; a pass-through of the \c op_data pointer
- * provided with the H5Ovisit() function call</td>
- * </tr>
- * </table>
- *
- * The H5O_info2_t \c struct is defined in H5Opublic.h as follows:
- * \snippet this H5O_info2_t_snip
- *
- * H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The #H5O_type_t enum indicates the object type and is
- * defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p obj_id
- * refers only to the types specified by #H5O_type_t.
- *
- * The return values from an operator are:
- * - Zero causes the visit iterator to continue, returning zero when all
- * group members have been processed.
- * - A positive value causes the visit iterator to immediately return that
- * positive value, indicating short-circuit success.
- * - A negative value causes the visit iterator to immediately return that
- * value, indicating failure.
+ * along the index specified in \p idx_type.
*
* The H5Ovisit3() \p op_data parameter is a user-defined pointer to the data
* required to process objects in the course of the iteration. This pointer
@@ -1329,24 +1195,6 @@ H5_DLL ssize_t H5Oget_comment_by_name(hid_t loc_id, const char *name, char *comm
* group change during the iteration, the resulting behavior
* is undefined.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \par Example
* An example snippet from test/links.c:
* \snippet links.c H5Ovisit3_snip
@@ -1411,10 +1259,7 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in a
@@ -1425,49 +1270,7 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate2_t_snip
- *
- * The parameters of this callback function have the following
- * values or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info2_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object</td>
- * </tr>
- * </table>
- *
- * The H5O_info2_t \c struct is defined in H5Opublic.h as follows:
- * \snippet this H5O_info2_t_snip
- *
- * H5O_token_t is defined in H5public.h as follows:
- * \snippet H5public.h H5O_token_t_snip
- *
- * The #H5O_type_t enum indicates the object type and is
- * defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
+ * along the index specified in \p idx_type.
*
* The H5Ovisit_by_name3() \p op_data parameter is a user-defined
* pointer to the data required to process objects in the course
@@ -1495,24 +1298,6 @@ H5_DLL herr_t H5Ovisit3(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* in the file has been presented to the application for whatever
* processing the application requires.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \par Example
* An example snippet from test/links.c:
* \snippet links.c H5Ovisit_by_name3_snip
@@ -1579,26 +1364,11 @@ H5_DLL herr_t H5Oclose_async(const char *app_file, const char *app_func, unsigne
* files. After that, the OS is responsible for ensuring that
* the data is actually flushed to disk.
*
- * \par See Also:
- * - H5Dflush()
- * - H5Drefresh()
- * - H5Oflush()
- * - H5Grefresh()
- * - H5Oflush()
- * - H5Orefresh()
- * - H5Tflush()
- * - H5Trefresh()
- * \par
- * - \c H5DOappend()
- * - H5Fstart_swmr_write()
- * - H5Pget_append_flush()
- * - H5Pget_object_flush_cb()
- * - H5Pset_append_flush()
- * - H5Pset_object_flush_cb()
- * \par
- * - H5Oare_mdc_flushes_disabled()
- * - H5Odisable_mdc_flushes()
- * - H5Oenable_mdc_flushes()
+ * \see H5Dflush(), H5Drefresh(), H5Oflush(), H5Grefresh(), H5Oflush(),
+ * H5Orefresh(), H5Tflush(), H5Trefresh()
+ * \see H5DOappend(), H5Fstart_swmr_write(), H5Pget_append_flush(),
+ * H5Pget_object_flush_cb(), H5Pset_append_flush(), H5Pset_object_flush_cb()
+ * \see H5Oare_mdc_flushes_disabled(), H5Odisable_mdc_flushes(), H5Oenable_mdc_flushes()
*
* \since 1.10.0
*
@@ -1670,21 +1440,17 @@ H5_DLL herr_t H5Orefresh_async(const char *app_file, const char *app_func, unsig
* HDF5 object level (datasets, groups, committed datatypes)
* and the entire metadata cache level.
*
- * \note HDF5 objects include datasets, groups, and committed datatypes.
- * Only #hid_t identifiers that represent these objects can be passed to the function.
- * \note Passing in a #hid_t identifier that represents any other HDF5 entity is
- * considered an error.
- * \note It is an error to pass an HDF5 file identifier
- * (obtained from H5Fopen() or H5Fcreate())
- * to this function.
- * \note Misuse of this function can cause the cache to exhaust
- * available memory.
- * \note Objects can be returned to the default automatic flush behavior
- * with H5Oenable_mdc_flushes().
- * \note Flush prevention only pertains to new or dirty metadata entries.
- * Clean entries can be evicted from the cache.
- * \note Calling this function on an object that has already had flushes
- * disabled will return an error.
+ * \note HDF5 objects include datasets, groups, and committed datatypes. Only
+ * #hid_t identifiers that represent these objects can be passed to the
+ * function. Passing in a #hid_t identifier that represents any other
+ * HDF5 entity is considered an error. It is an error to pass an HDF5
+ * file identifier (obtained from H5Fopen() or H5Fcreate()) to this
+ * function. Misuse of this function can cause the cache to exhaust
+ * available memory. Objects can be returned to the default automatic
+ * flush behavior with H5Oenable_mdc_flushes(). Flush prevention only
+ * pertains to new or dirty metadata entries. Clean entries can be
+ * evicted from the cache. Calling this function on an object that has
+ * already had flushes disabled will return an error.
*
* \since 1.10.0
*
@@ -1714,28 +1480,18 @@ H5_DLL herr_t H5Odisable_mdc_flushes(hid_t object_id);
* metadata cache level.
*
*
- * \note HDF5 objects include datasets, groups, and committed datatypes.
- * Only #hid_t identifiers that represent these objects can be
- * passed to the function.
- *
- * \note Passing in a #hid_t identifier that represents any other HDF5 entity
- * is considered an error.
- *
- * \note It is an error to pass an HDF5 file identifier
- * (obtained from H5Fopen() or H5Fcreate())
- * to this function.
- *
- * \note Using this function on an object that has not had flushes disabled
- * is considered an error. The state of an object can be determined
- * with H5Oare_mdc_flushes_disabled().
- *
- * \note An object will be returned to the default flush algorithm when it is closed.
- *
- * \note All objects will be returned to the default flush algorithm when
- * the file is closed.
- *
- * \note An object’s entries will not necessarily be flushed as a result of
- * calling this function.
+ * \note HDF5 objects include datasets, groups, and committed datatypes. Only
+ * #hid_t identifiers that represent these objects can be passed to the
+ * function. Passing in a #hid_t identifier that represents any other
+ * HDF5 entity is considered an error. It is an error to pass an HDF5
+ * file identifier (obtained from H5Fopen() or H5Fcreate()) to this
+ * function. Using this function on an object that has not had flushes
+ * disabled is considered an error. The state of an object can be
+ * determined with H5Oare_mdc_flushes_disabled(). An object will be
+ * returned to the default flush algorithm when it is closed. All objects
+ * will be returned to the default flush algorithm when the file is
+ * closed. An object’s entries will not necessarily be flushed as a
+ * result of calling this function.
*
* \since 1.10.0
*
@@ -1871,6 +1627,7 @@ H5_DLL herr_t H5Otoken_to_str(hid_t loc_id, const H5O_token_t *token, char **tok
*/
H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t *token);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -1894,6 +1651,7 @@ H5_DLL herr_t H5Otoken_from_str(hid_t loc_id, const char *token_str, H5O_token_t
#define H5Orefresh_async_wrap H5_NO_EXPAND(H5Orefresh_async)
#define H5Ocopy_async_wrap H5_NO_EXPAND(H5Ocopy_async)
#endif
+/// \endcond
/* The canonical 'undefined' token value */
#define H5O_TOKEN_UNDEF (H5OPEN H5O_TOKEN_UNDEF_g)
@@ -1908,8 +1666,8 @@ H5_DLLVAR const H5O_token_t H5O_TOKEN_UNDEF_g;
/* Macros */
/* Deprecated flags for earlier versions of H5Oget_info* */
-#define H5O_INFO_HDR 0x0008u /* Fill in the hdr field */
-#define H5O_INFO_META_SIZE 0x0010u /* Fill in the meta_size field */
+#define H5O_INFO_HDR 0x0008u /**< Fill in the hdr field */
+#define H5O_INFO_META_SIZE 0x0010u /**< Fill in the meta_size field */
#undef H5O_INFO_ALL
#define H5O_INFO_ALL (H5O_INFO_BASIC | H5O_INFO_TIME | H5O_INFO_NUM_ATTRS | H5O_INFO_HDR | H5O_INFO_META_SIZE)
@@ -1942,7 +1700,7 @@ typedef struct H5O_info1_t {
time_t mtime; /**< Modification time */
time_t ctime; /**< Change time */
time_t btime; /**< Birth time */
- hsize_t num_attrs; /**< # of attributes attached to object */
+ hsize_t num_attrs; /**< Number of attributes attached to object */
H5O_hdr_info_t hdr; /**< Object header information */
/* Extra metadata storage for obj & attributes */
struct {
@@ -1955,6 +1713,16 @@ typedef struct H5O_info1_t {
//! <!-- [H5O_iterate1_t_snip] -->
/**
* Prototype for H5Ovisit(), H5Ovisit_by_name() operator (versions 1 & 2)
+ *
+ * \param[in] obj Object that serves as the root of the iteration;
+ * the same value as the H5Ovisit1() \c obj_id parameter
+ * \param[in] name Name of object, relative to \p obj, being examined at current
+ * step of the iteration
+ * \param[out] info Information about that object
+ * \param[in,out] op_data User-defined pointer to data required by the application
+ * in processing the object
+ * \return \herr_t_iter
+ *
*/
typedef herr_t (*H5O_iterate1_t)(hid_t obj, const char *name, const H5O_info1_t *info, void *op_data);
//! <!-- [H5O_iterate1_t_snip] -->
@@ -2027,36 +1795,7 @@ H5_DLL hid_t H5Oopen_by_addr(hid_t loc_id, haddr_t addr);
* the function H5Oget_info3() or the macro #H5Oget_info.
*
* \details H5Oget_info1() specifies an object by its identifier, \p loc_id , and
- * retrieves the metadata describing that object in \p oinfo ,
- * defined as a \c struct of type H5O_info1_t :
- *
- * \snippet this H5O_info1_t_snip
- *
- * Note the following about H5O_info1_t :
- * - Of the four time fields (\c atime, \c mtime, \c ctime, and \c btime)
- * only \c ctime has been implemented.
- * - The \c atime value is the last time the object was read or written.
- * - The \c mtime value is the last time the raw data in the object was changed.
- * - The \c ctime value is the last time the metadata for the object was changed.
- * - The \c btime value is the time the object was created.
- * - The fields nested in the \c meta_size field are for internal library use only.
- *
- * The #H5O_type_t \c enum indicates the object type and
- * is defined in H5Opublic.h as follows:
- * \snippet this H5O_type_t_snip
- *
- * Note that the object retrieved as indicated by \p loc_id
- * refers only to the types specified by #H5O_type_t.
- *
- * An H5O_hdr_info_t \c struct holds object header metadata and is
- * defined in H5Opublic.h as follows:
- * \snippet this H5O_hdr_info_t_snip
- *
- * Valid values for the \c version field are \c H5O_VERSION_1 and \c H5O_VERSION_2.
- * Version 2 of the object header is smaller and more efficient than version 1.
- *
- * Please be aware that the information held by H5O_hdr_info_t may only be useful to
- * developers with extensive HDF5 experience.
+ * retrieves the metadata describing that object in \p oinfo.
*
* \note If you are iterating through a lot of different objects to
* retrieve information via the H5Oget_info() family of routines,
@@ -2156,16 +1895,6 @@ H5_DLL herr_t H5Oget_info_by_name1(hid_t loc_id, const char *name, H5O_info1_t *
* If \p loc_id fully specifies the group in which the object resides,
* \p group_name can be a dot (\c .).
*
- * \p idx_type is of type #H5_index_t, defined in H5public.h as:
- * \snippet H5public.h H5_index_t_snip
- *
- * \p order is of type #H5_iter_order_t defined in H5public.h as:
- * \snippet H5public.h H5_iter_order_t_snip
- *
- * \p oinfo, in which the object information is returned, is a \c struct of
- * type H5O_info1_t .
- * \snippet this H5O_info1_t_snip
- *
* The link access property list, \c lapl_id, is not currently used;
* it should be passed in as #H5P_DEFAULT.
*
@@ -2361,10 +2090,7 @@ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in
@@ -2375,56 +2101,7 @@ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate1_t_snip
- *
- * The parameters of this callback function have the following values
- * or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration;
- * same value as the H5Ovisit1() \p obj_id parameter</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info1_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object</td>
- * </tr>
- * </table>
- *
- * The H5O_info1_t \c struct is defined in H5Opublic.h:
- * \snippet this H5O_info1_t_snip
- *
- * The return values from an operator are:
- * - Zero causes the visit iterator to continue, returning zero when all
- * group members have been processed.
- * - A positive value causes the visit iterator to immediately return that
- * positive value, indicating short-circuit success.
- * - A negative value causes the visit iterator to immediately return that
- * value, indicating failure.
- *
- * The H5Ovisit1() \p op_data parameter is a user-defined pointer to the data
- * required to process objects in the course of the iteration. This pointer
- * is passed back to each step of the iteration in the callback
- * function’s \p op_data parameter.
+ * along the index specified in \p idx_type.
*
* H5Lvisit1() and H5Ovisit1() are companion functions: one for
* examining and operating on links; the other for examining
@@ -2438,24 +2115,6 @@ H5_DLL herr_t H5Oget_info_by_idx2(hid_t loc_id, const char *group_name, H5_index
* group change during the iteration, the resulting behavior
* is undefined.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \version 1.10.5 The macro #H5Ovisit was removed and the function
* H5Ovisit1() was copied to H5Ovisit().
* \version 1.10.3 Function H5Ovisit() was copied to H5Ovisit1(),
@@ -2523,10 +2182,7 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in a
@@ -2537,10 +2193,7 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
+ * along the index specified in \p idx_type.
*
* The \p op callback function and the effect of the callback
* function’s return value on the application are described
@@ -2570,24 +2223,6 @@ H5_DLL herr_t H5Ovisit1(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* in the file has been presented to the application for whatever
* processing the application requires.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \version 1.10.5 The macro #H5Ovisit_by_name was removed and the function
* H5Ovisit_by_name1() was copied to #H5Ovisit_by_name.
* \version 1.10.3 The H5Ovisit_by_name() function was renamed to H5Ovisit_by_name1(),
@@ -2650,10 +2285,7 @@ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t i
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in
@@ -2664,57 +2296,7 @@ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t i
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
- *
- * The prototype of the callback function op is as follows (as
- * defined in the source code file H5Opublic.h):
- *
- * \snippet this H5O_iterate1_t_snip
- *
- * The parameters of this callback function have the following values
- * or meanings:
- * <table>
- * <tr>
- * <td>\c obj</td>
- * <td>Object that serves as root of the iteration;
- * same value as the H5Ovisit1() \p obj_id parameter</td>
- * </tr>
- * <tr>
- * <td>\c name</td>
- * <td>Name of object, relative to \c obj, being examined at
- * current step of the iteration</td>
- * </tr>
- * <tr>
- * <td>\c info</td>
- * <td>H5O_info1_t \c struct containing information
- * regarding that object</td>
- * </tr>
- * <tr>
- * <td>\c op_data</td>
- * <td>User-defined pointer to data required by the application in
- * processing the object; a pass-through of the \c op_data pointer
- * provided with the H5Ovisit() function call</td>
- * </tr>
- * </table>
- *
- * The H5O_info1_t \c struct is defined in H5Opublic.h and
- * described in the H5Oget_info1() function entry.
- *
- * The return values from an operator are:
- * - Zero causes the visit iterator to continue, returning zero when all
- * group members have been processed.
- * - A positive value causes the visit iterator to immediately return that
- * positive value, indicating short-circuit success.
- * - A negative value causes the visit iterator to immediately return that
- * value, indicating failure.
- *
- * The H5Ovisit2() \p op_data parameter is a user-defined pointer to the data
- * required to process objects in the course of the iteration. This pointer
- * is passed back to each step of the iteration in the callback
- * function’s \p op_data parameter.
+ * along the index specified in \p idx_type.
*
* The \p fields parameter contains flags to determine which fields will
* be retrieved by the \p op callback function. These flags are defined
@@ -2733,23 +2315,6 @@ H5_DLL herr_t H5Ovisit_by_name1(hid_t loc_id, const char *obj_name, H5_index_t i
* group change during the iteration, the resulting behavior
* is undefined.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
*
* \since 1.10.3
*
@@ -2814,10 +2379,7 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* a group have not been indexed by the index type, they will
* first be sorted by that index then the iteration will begin;
* if the links have been so indexed, the sorting step will be
- * unnecessary, so the iteration may begin more quickly. Valid
- * values include the following:
- *
- * \indexes
+ * unnecessary, so the iteration may begin more quickly.
*
* Note that the index type passed in \p idx_type is a
* <em>best effort</em> setting. If the application passes in a
@@ -2828,10 +2390,7 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* used by the HDF5 library and is always available.)
*
* \p order specifies the order in which objects are to be inspected
- * along the index specified in \p idx_type. Valid values include
- * the following:
- *
- * \orders
+ * along the index specified in \p idx_type.
*
* The \p op callback function and the effect of the callback
* function’s return value on the application are described
@@ -2866,24 +2425,6 @@ H5_DLL herr_t H5Ovisit2(hid_t obj_id, H5_index_t idx_type, H5_iter_order_t order
* in the file has been presented to the application for whatever
* processing the application requires.
*
- * \note \Bold{Programming Note for C++ Developers Using C Functions:}
- * \note If a C routine that takes a function pointer as an argument is
- * called from within C++ code, the C routine should be returned
- * from normally.
- *
- * \note Examples of this kind of routine include callbacks such as
- * H5Pset_elink_cb() and H5Pset_type_conv_cb() and
- * functions such as H5Tconvert() and H5Ewalk2().
- *
- * \note Exiting the routine in its normal fashion allows the HDF5
- * C library to clean up its work properly. In other words, if
- * the C++ application jumps out of the routine back to the C++
- * “catch” statement, the library is not given the opportunity
- * to close any temporary data structures that were set up when
- * the routine was called. The C++ application should save some
- * state as the routine is started so that any problem that occurs
- * might be diagnosed.
- *
* \since 1.10.3
*
*/
diff --git a/src/H5PB.c b/src/H5PB.c
index 57ef7fb..ef93bd7 100644
--- a/src/H5PB.c
+++ b/src/H5PB.c
@@ -2121,7 +2121,7 @@ H5PB_vfd_swmr__update_index(H5F_t *f, uint32_t *idx_ent_added_ptr, uint32_t *idx
/* partial initialization of new entry -- rest done later */
ie_ptr->hdf5_page_offset = target_page;
ie_ptr->md_file_page_offset = 0; /* undefined at this point */
- ie_ptr->chksum = 0; /* undefined at this point */
+ ie_ptr->checksum = 0; /* undefined at this point */
/* ie_ptr->entry_ptr initialized below */
/* ie_ptr->tick_of_last_change initialized below */
/* ie_ptr->clean initialized below */
diff --git a/src/H5PL.c b/src/H5PL.c
index 06443f3..30b6c52 100644
--- a/src/H5PL.c
+++ b/src/H5PL.c
@@ -359,7 +359,7 @@ H5PLget(unsigned int idx, char *path_buf, size_t buf_size)
/* If the path buffer is not NULL, copy the path to the buffer */
if (path_buf) {
- HDstrncpy(path_buf, path, MIN((size_t)(path_len + 1), buf_size));
+ HDstrncpy(path_buf, path, buf_size);
if ((size_t)path_len >= buf_size)
path_buf[buf_size - 1] = '\0';
} /* end if */
diff --git a/src/H5PLint.c b/src/H5PLint.c
index cf6135d..d20401e 100644
--- a/src/H5PLint.c
+++ b/src/H5PLint.c
@@ -236,11 +236,13 @@ H5PL_load(H5PL_type_t type, const H5PL_key_t *key)
if ((H5PL_plugin_control_mask_g & H5PL_FILTER_PLUGIN) == 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL, "filter plugins disabled")
break;
+
case H5PL_TYPE_VOL:
if ((H5PL_plugin_control_mask_g & H5PL_VOL_PLUGIN) == 0)
HGOTO_ERROR(H5E_PLUGIN, H5E_CANTLOAD, NULL,
"Virtual Object Layer (VOL) driver plugins disabled")
break;
+
case H5PL_TYPE_ERROR:
case H5PL_TYPE_NONE:
default:
@@ -290,7 +292,7 @@ done:
* get_plugin_info function pointer, but early (4.4.7, at least) gcc
* only allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("pedantic")
+H5_GCC_CLANG_DIAG_OFF("pedantic")
herr_t
H5PL__open(const char *path, H5PL_type_t type, const H5PL_key_t *key, hbool_t *success,
H5PL_type_t *plugin_type, const void **plugin_info)
@@ -412,7 +414,7 @@ done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__open() */
-H5_GCC_DIAG_ON("pedantic")
+H5_GCC_CLANG_DIAG_ON("pedantic")
/*-------------------------------------------------------------------------
* Function: H5PL__close
diff --git a/src/H5PLmodule.h b/src/H5PLmodule.h
index ab9f1d5..a093096 100644
--- a/src/H5PLmodule.h
+++ b/src/H5PLmodule.h
@@ -28,8 +28,34 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5PL H5PL
- * \brief Plugins
- * \todo Describe what programmatically controlling dynamically loaded plugins (H5PL) is all about
+ *
+ * Use the functions in this module to manage the loading behavior of HDF5
+ * plugins.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5PL_examples.c create
+ * </td>
+ * <td>
+ * \snippet H5PL_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet H5PL_examples.c update
+ * </td>
+ * <td>
+ * \snippet H5PL_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \attention The loading behavior of HDF5 plugins can be controlled via the
+ * functions described below and certain environment variables, such
+ * as \c HDF5_PLUGIN_PRELOAD and \c HDF5_PLUGIN_PATH.
+ *
*/
#endif /* H5PLmodule_H */
diff --git a/src/H5PLplugin_cache.c b/src/H5PLplugin_cache.c
index 2ec0845..b7cdac0 100644
--- a/src/H5PLplugin_cache.c
+++ b/src/H5PLplugin_cache.c
@@ -242,7 +242,7 @@ done:
/* See the other use of H5PL_GET_LIB_FUNC() for an explanation
* for why we disable -Wpedantic here.
*/
-H5_GCC_DIAG_OFF("pedantic")
+H5_GCC_CLANG_DIAG_OFF("pedantic")
herr_t
H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *found,
const void **plugin_info)
@@ -263,35 +263,61 @@ H5PL__find_plugin_in_cache(const H5PL_search_params_t *search_params, hbool_t *f
/* Loop over all the plugins, looking for one that matches */
for (u = 0; u < H5PL_num_plugins_g; u++) {
-
- /* If the plugin type (filter, VOL connector, etc.) and ID match, query the plugin for its info */
- if ((search_params->type == (H5PL_cache_g[u]).type) &&
- (search_params->key->id == (H5PL_cache_g[u]).key.id)) {
-
- H5PL_get_plugin_info_t get_plugin_info_function;
- const void * info;
-
- /* Get the "get plugin info" function from the plugin. */
- if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(
- (H5PL_cache_g[u]).handle, "H5PLget_plugin_info")))
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
-
- /* Call the "get plugin info" function */
- if (NULL == (info = (*get_plugin_info_function)()))
- HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info")
-
- /* Set output parameters */
- *found = TRUE;
- *plugin_info = info;
-
- /* No need to continue processing */
- break;
-
- } /* end if */
-
- } /* end for */
+ /* If the plugin type (filter, VOL connector, etc.) match, proceed */
+ if (search_params->type == H5PL_cache_g[u].type) {
+ hbool_t matched = FALSE; /* Whether cached plugin info matches */
+
+ switch (search_params->type) {
+ case H5PL_TYPE_FILTER:
+ if (search_params->key->id == H5PL_cache_g[u].key.id)
+ matched = TRUE;
+ break;
+
+ case H5PL_TYPE_VOL:
+ if (search_params->key->vol.kind == H5VL_GET_CONNECTOR_BY_VALUE) {
+ if (search_params->key->vol.u.value == H5PL_cache_g[u].key.vol.u.value)
+ matched = TRUE;
+ } /* end if */
+ else if (search_params->key->vol.kind == H5VL_GET_CONNECTOR_BY_NAME) {
+ if (0 == HDstrcmp(search_params->key->vol.u.name, H5PL_cache_g[u].key.vol.u.name))
+ matched = TRUE;
+ } /* end else-if */
+ else
+ HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, FAIL, "bad VOL plugin search key type")
+ break;
+
+ case H5PL_TYPE_ERROR:
+ case H5PL_TYPE_NONE:
+ default:
+ HGOTO_ERROR(H5E_PLUGIN, H5E_BADVALUE, FAIL, "bad plugin type")
+ } /* end switch */
+
+ /* If the plugin type (filter, VOL connector, etc.) and key match, query the plugin for its info
+ */
+ if (matched) {
+ H5PL_get_plugin_info_t get_plugin_info_function;
+ const void * info;
+
+ /* Get the "get plugin info" function from the plugin. */
+ if (NULL == (get_plugin_info_function = (H5PL_get_plugin_info_t)H5PL_GET_LIB_FUNC(
+ (H5PL_cache_g[u]).handle, "H5PLget_plugin_info")))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get function for H5PLget_plugin_info")
+
+ /* Call the "get plugin info" function */
+ if (NULL == (info = (*get_plugin_info_function)()))
+ HGOTO_ERROR(H5E_PLUGIN, H5E_CANTGET, FAIL, "can't get plugin info")
+
+ /* Set output parameters */
+ *found = TRUE;
+ *plugin_info = info;
+
+ /* No need to continue processing */
+ break;
+ } /* end if */
+ } /* end if */
+ } /* end for */
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5PL__find_plugin_in_cache() */
-H5_GCC_DIAG_ON("pedantic")
+H5_GCC_CLANG_DIAG_ON("pedantic")
diff --git a/src/H5Pdapl.c b/src/H5Pdapl.c
index 2ebdbe3..d374b25 100644
--- a/src/H5Pdapl.c
+++ b/src/H5Pdapl.c
@@ -1453,7 +1453,7 @@ H5Pget_efile_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
/* Copy to user's buffer, if given */
len = HDstrlen(my_prefix);
if (prefix) {
- HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ HDstrncpy(prefix, my_prefix, size);
if (len >= size)
prefix[size - 1] = '\0';
} /* end if */
@@ -1543,7 +1543,7 @@ H5Pget_virtual_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
/* Copy to user's buffer, if given */
len = HDstrlen(my_prefix);
if (prefix) {
- HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ HDstrncpy(prefix, my_prefix, size);
if (len >= size)
prefix[size - 1] = '\0';
} /* end if */
diff --git a/src/H5Pdxpl.c b/src/H5Pdxpl.c
index 046b046..46dc94c 100644
--- a/src/H5Pdxpl.c
+++ b/src/H5Pdxpl.c
@@ -68,7 +68,7 @@
#define H5D_XFER_BTREE_SPLIT_RATIO_SIZE sizeof(double[3])
#define H5D_XFER_BTREE_SPLIT_RATIO_DEF \
{ \
- 0.1f, 0.5f, 0.9f \
+ 0.1, 0.5, 0.9 \
}
#define H5D_XFER_BTREE_SPLIT_RATIO_ENC H5P__dxfr_btree_split_ratio_enc
#define H5D_XFER_BTREE_SPLIT_RATIO_DEC H5P__dxfr_btree_split_ratio_dec
@@ -1052,7 +1052,7 @@ H5Pget_data_transform(hid_t plist_id, char *expression /*out*/, size_t size)
/* Copy into application buffer */
len = HDstrlen(pexp);
if (expression) {
- HDstrncpy(expression, pexp, MIN(len + 1, size));
+ HDstrncpy(expression, pexp, size);
if (len >= size)
expression[size - 1] = '\0';
} /* end if */
@@ -2281,7 +2281,7 @@ herr_t
H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op, const hsize_t start[],
const hsize_t stride[], const hsize_t count[], const hsize_t block[])
{
- H5P_genplist_t *plist; /* Property list pointer */
+ H5P_genplist_t *plist = NULL; /* Property list pointer */
H5S_t * space; /* Dataspace to hold selection */
hbool_t space_created = FALSE; /* Whether a new dataspace has been created */
hbool_t reset_prop_on_error = FALSE; /* Whether to reset the property on failure */
@@ -2371,7 +2371,7 @@ H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper
done:
/* Cleanup on failure */
if (ret_value < 0) {
- if (reset_prop_on_error && H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
+ if (reset_prop_on_error && plist && H5P_poke(plist, H5D_XFER_DSET_IO_SEL_NAME, &space) < 0)
HDONE_ERROR(H5E_PLIST, H5E_CANTSET, FAIL, "error setting dataset I/O selection")
if (space_created && H5S_close(space) < 0)
HDONE_ERROR(H5E_PLIST, H5E_CLOSEERROR, FAIL, "unable to release dataspace")
diff --git a/src/H5Pencdec.c b/src/H5Pencdec.c
index 5b0ecb6..e2a97f8 100644
--- a/src/H5Pencdec.c
+++ b/src/H5Pencdec.c
@@ -333,7 +333,7 @@ H5P__encode_cb(H5P_genprop_t *prop, void *_udata)
/* Encode (or not, if the 'encode' flag is off) the property's name */
prop_name_len = HDstrlen(prop->name) + 1;
if (udata->encode) {
- HDstrncpy((char *)*(udata->pp), prop->name, prop_name_len);
+ HDstrcpy((char *)*(udata->pp), prop->name);
*(uint8_t **)(udata->pp) += prop_name_len;
} /* end if */
*(udata->enc_size_ptr) += prop_name_len;
diff --git a/src/H5Pfapl.c b/src/H5Pfapl.c
index 5332ea6..ff9ff8a 100644
--- a/src/H5Pfapl.c
+++ b/src/H5Pfapl.c
@@ -74,7 +74,7 @@
#define H5F_ACS_DATA_CACHE_BYTE_SIZE_DEC H5P__decode_size_t
/* Definition for preemption read chunks first */
#define H5F_ACS_PREEMPT_READ_CHUNKS_SIZE sizeof(double)
-#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75f
+#define H5F_ACS_PREEMPT_READ_CHUNKS_DEF 0.75
#define H5F_ACS_PREEMPT_READ_CHUNKS_ENC H5P__encode_double
#define H5F_ACS_PREEMPT_READ_CHUNKS_DEC H5P__decode_double
/* Definition for threshold for alignment */
@@ -318,6 +318,16 @@
#define H5F_ACS_VFD_SWMR_CONFIG_ENC H5P__facc_vfd_swmr_config_enc
#define H5F_ACS_VFD_SWMR_CONFIG_DEC H5P__facc_vfd_swmr_config_dec
+/* Private property for VFD SWMR testing:
+ * Callback function to generate checksum for metadata file
+ */
+#define H5F_ACS_GENERATE_MD_CK_CB_SIZE sizeof(H5F_generate_md_ck_cb_t)
+
+#define H5F_ACS_GENERATE_MD_CK_CB_DEF \
+ { \
+ NULL \
+ }
+
/******************/
/* Local Typedefs */
/******************/
@@ -515,6 +525,8 @@ static const hbool_t H5F_def_ignore_disabled_file_locks_g =
H5F_ACS_IGNORE_DISABLED_FILE_LOCKS_DEF; /* Default ignore disabled file locks flag */
static const H5F_vfd_swmr_config_t H5F_def_vfd_swmr_config_g =
H5F_ACS_VFD_SWMR_CONFIG_DEF; /* Default vfd swmr configuration */
+/* For VFD SWMR testing only: Default to generate checksum for metadata file */
+static const H5F_generate_md_ck_t H5F_def_generate_md_ck_cb_g = H5F_ACS_GENERATE_MD_CK_CB_DEF;
/*-------------------------------------------------------------------------
* Function: H5P__facc_reg_prop
@@ -633,6 +645,14 @@ H5P__facc_reg_prop(H5P_genclass_t *pclass)
NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+ /* Register the private property of whether to generate checksum for metadata file.
+ * It's used for VFD SWMR testing only. */
+ /* (Note: this property should not have an encode/decode callback -QAK) */
+ if (H5P__register_real(pclass, H5F_ACS_GENERATE_MD_CK_CB_NAME, H5F_ACS_GENERATE_MD_CK_CB_SIZE,
+ &H5F_def_generate_md_ck_cb_g, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTINSERT, FAIL, "can't insert property into class")
+
/* Register the data type of multi driver info */
if (H5P__register_real(pclass, H5F_ACS_MULTI_TYPE_NAME, H5F_ACS_MULTI_TYPE_SIZE, &H5F_def_mem_type_g,
NULL, NULL, NULL, H5F_ACS_MULTI_TYPE_ENC, H5F_ACS_MULTI_TYPE_DEC, NULL, NULL, NULL,
@@ -4097,11 +4117,16 @@ H5P__facc_vfd_swmr_config_enc(const void *value, void **_pp, size_t *size)
INT32ENCODE(*pp, (int32_t)config->tick_len);
INT32ENCODE(*pp, (int32_t)config->max_lag);
H5_ENCODE_UNSIGNED(*pp, config->writer);
+ H5_ENCODE_UNSIGNED(*pp, config->maintain_metadata_file);
+ H5_ENCODE_UNSIGNED(*pp, config->generate_updater_files);
H5_ENCODE_UNSIGNED(*pp, config->flush_raw_data);
INT32ENCODE(*pp, (int32_t)config->md_pages_reserved);
INT32ENCODE(*pp, (int32_t)config->pb_expansion_threshold);
HDmemcpy(*pp, (const uint8_t *)(config->md_file_path), (size_t)(H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1));
*pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1;
+ HDmemcpy(*pp, (const uint8_t *)(config->updater_file_path),
+ (size_t)(H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1));
+ *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1;
HDmemcpy(*pp, (const uint8_t *)(config->log_file_path),
(size_t)(H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1));
*pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1;
@@ -4109,7 +4134,7 @@ H5P__facc_vfd_swmr_config_enc(const void *value, void **_pp, size_t *size)
} /* end if */
/* Compute encoded size */
- *size += ((5 * sizeof(int32_t)) + (2 * sizeof(unsigned)) + (2 * (H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1)));
+ *size += ((5 * sizeof(int32_t)) + (4 * sizeof(unsigned)) + (3 * (H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1)));
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5P__facc_vfd_swmr_config_enc() */
@@ -4150,6 +4175,8 @@ H5P__facc_vfd_swmr_config_dec(const void **_pp, void *_value)
UINT32DECODE(*pp, config->max_lag);
H5_DECODE_UNSIGNED(*pp, config->writer);
+ H5_DECODE_UNSIGNED(*pp, config->maintain_metadata_file);
+ H5_DECODE_UNSIGNED(*pp, config->generate_updater_files);
H5_DECODE_UNSIGNED(*pp, config->flush_raw_data);
/* int */
@@ -4159,6 +4186,9 @@ H5P__facc_vfd_swmr_config_dec(const void **_pp, void *_value)
HDstrcpy(config->md_file_path, (const char *)(*pp));
*pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1;
+ HDstrcpy(config->updater_file_path, (const char *)(*pp));
+ *pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1;
+
HDstrcpy(config->log_file_path, (const char *)(*pp));
*pp += H5F__MAX_VFD_SWMR_FILE_NAME_LEN + 1;
@@ -4917,8 +4947,7 @@ H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective)
/* (Dataset, group, attribute, and named datype access property lists
* are sub-classes of link access property lists -QAK)
*/
- if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) &&
- TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist")
/* set property to either TRUE if > 0, or FALSE otherwise */
@@ -4969,8 +4998,7 @@ H5Pget_all_coll_metadata_ops(hid_t plist_id, hbool_t *is_collective /*out*/)
/* (Dataset, group, attribute, and named datype access property lists
* are sub-classes of link access property lists -QAK)
*/
- if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) &&
- TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_DATASET_XFER))
+ if (TRUE != H5P_isa_class(plist_id, H5P_LINK_ACCESS) && TRUE != H5P_isa_class(plist_id, H5P_FILE_ACCESS))
HGOTO_ERROR(H5E_PLIST, H5E_CANTREGISTER, FAIL, "property list is not an access plist")
/* Get value */
@@ -5703,12 +5731,34 @@ H5Pset_vfd_swmr_config(hid_t plist_id, H5F_vfd_swmr_config_t *config_ptr)
if (config_ptr->pb_expansion_threshold > H5F__MAX_PB_EXPANSION_THRESHOLD)
HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "pb_expansion_threshold out of range")
- /* Must provide the path for the metadata file */
- name_len = HDstrlen(config_ptr->md_file_path);
- if (name_len == 0)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "md_file_path is empty")
- else if (name_len > H5F__MAX_VFD_SWMR_FILE_NAME_LEN)
- HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "md_file_path is too long")
+ /* If writer is TRUE, at least one of maintain_metadata_file and generate_updater_files must be TRUE */
+ if (config_ptr->writer) {
+ if (!config_ptr->maintain_metadata_file && !config_ptr->generate_updater_files)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL,
+ "either maintain_metadata_file or generate_updater_files must be TRUE")
+ }
+
+ if ((config_ptr->writer && config_ptr->maintain_metadata_file) || !config_ptr->writer) {
+ /* Must provide the path and base name of the metadata file */
+ name_len = HDstrlen(config_ptr->md_file_path);
+ if (name_len == 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "md_file_path is empty")
+ else if (name_len > H5F__MAX_VFD_SWMR_FILE_NAME_LEN)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "md_file_path is too long")
+ }
+
+ if (config_ptr->writer && config_ptr->generate_updater_files) {
+ /* Must provide the path and base name of the metadata updater files */
+ name_len = HDstrlen(config_ptr->updater_file_path);
+ if (name_len == 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "updater_file_path is empty")
+ else if (name_len > H5F__MAX_VFD_SWMR_FILE_NAME_LEN)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "updater_file_path is too long")
+ }
+
+ name_len = HDstrlen(config_ptr->log_file_path);
+ if (name_len > H5F__MAX_VFD_SWMR_FILE_NAME_LEN)
+ HGOTO_ERROR(H5E_PLIST, H5E_BADVALUE, FAIL, "log_file_path is too long")
/* Set the modified config */
if (H5P_set(plist, H5F_ACS_VFD_SWMR_CONFIG_NAME, config_ptr) < 0)
@@ -5930,6 +5980,64 @@ done:
} /* end H5Pget_vol_info() */
/*-------------------------------------------------------------------------
+ * Function: H5Pget_vol_cap_flags
+ *
+ * Purpose: Queries the current VOL connector information for a FAPL to
+ * retrieve the capability flags for the VOL connector stack, as will
+ * be used by a file open or create operation that uses this FAPL.
+ *
+ * Current capability flags are:
+ * H5VL_CAP_FLAG_THREADSAFE - Connector is threadsafe
+ * H5VL_CAP_FLAG_ASYNC - Connector performs operations asynchronously
+ * H5VL_CAP_FLAG_NATIVE_FILES - Connector produces native file format
+ *
+ * Note: This routine supports the use of the HDF5_VOL_CONNECTOR environment
+ * environment variable to override the VOL connector set programmatically
+ * for the FAPL (with H5Pset_vol).
+ *
+ * Note: The H5VL_CAP_FLAG_ASYNC flag can be checked to see if asynchronous
+ * operations are supported by the VOL connector stack.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*Iu", plist_id, cap_flags);
+
+ /* Get the 'cap_flags' from the connector */
+ if (cap_flags) {
+ if (TRUE == H5P_isa_class(plist_id, H5P_FILE_ACCESS)) {
+ H5P_genplist_t * plist; /* Property list pointer */
+ H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
+
+ /* Get property list for ID */
+ if (NULL == (plist = (H5P_genplist_t *)H5I_object_verify(plist_id, H5I_GENPROP_LST)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
+
+ /* Get the connector property */
+ if (H5P_peek(plist, H5F_ACS_VOL_CONN_NAME, &connector_prop) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector property")
+
+ /* Query the capability flags */
+ if (H5VL_get_cap_flags(&connector_prop, cap_flags) < 0)
+ HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get VOL connector capability flags")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file access property list")
+ } /* end if */
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5Pget_vol_cap_flags() */
+
+/*-------------------------------------------------------------------------
* Function: H5P__facc_vol_create
*
connectorose: Create callback for the VOL connector ID & info property.
diff --git a/src/H5Pint.c b/src/H5Pint.c
index b27a440..90fd1c2 100644
--- a/src/H5Pint.c
+++ b/src/H5Pint.c
@@ -4879,7 +4879,8 @@ H5P__copy_prop_plist(hid_t dst_id, hid_t src_id, const char *name)
/* If not, get the information required to do an H5Pinsert2 with the property into the destination list */
else {
/* Get the pointer to the source property */
- prop = H5P__find_prop_plist(src_plist, name);
+ if (NULL == (prop = H5P__find_prop_plist(src_plist, name)))
+ HGOTO_ERROR(H5E_PLIST, H5E_NOTFOUND, FAIL, "property doesn't exist")
/* Create property object from parameters */
if (NULL ==
diff --git a/src/H5Plapl.c b/src/H5Plapl.c
index 879e6ed..d00efaf 100644
--- a/src/H5Plapl.c
+++ b/src/H5Plapl.c
@@ -1044,7 +1044,7 @@ H5Pget_elink_prefix(hid_t plist_id, char *prefix /*out*/, size_t size)
/* Copy to user's buffer, if given */
len = HDstrlen(my_prefix);
if (prefix) {
- HDstrncpy(prefix, my_prefix, MIN(len + 1, size));
+ HDstrncpy(prefix, my_prefix, size);
if (len >= size)
prefix[size - 1] = '\0';
} /* end if */
diff --git a/src/H5Pmodule.h b/src/H5Pmodule.h
index 18f30c6..6e92e66 100644
--- a/src/H5Pmodule.h
+++ b/src/H5Pmodule.h
@@ -30,49 +30,165 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5P H5P
- * \brief Property List Interface
*
- * \details The HDF5 Property List Interface provides a mechanism to take
- * advantage of more powerful or unusual features in HDF5.
+ * Use the functions in this module to manage HDF5 property lists and property
+ * list classes. HDF5 property lists are the main vehicle to configure the
+ * behavior of HDF5 API functions.
*
- * HDF5 objects have properties or characteristics associated with
- * them, and there are default properties that handle the most
- * common needs. These default properties can be modified using the
- * HDF5 Property List Interface. For example, the data storage
- * layout property of a dataset is contiguous by default. For better
- * performance, the layout can be modified to be chunked or chunked
- * and compressed.
+ * Typically, property lists are created by instantiating one of the built-in
+ * or user-defined property list classes. After adding suitable properties,
+ * property lists are used when opening or creating HDF5 items, or when reading
+ * or writing data. Property lists can be modified by adding or changing
+ * properties. Property lists are deleted by closing the associated handles.
*
- * \todo Describe concisely what the functions in this module are about.
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
- * \defgroup GPLO General Property List Operations
+ * \defgroup ALCAPL Attribute and Link Creation Properties
* \ingroup H5P
- * \defgroup GPLOA General Property List Operations (Advanced)
+ * Currently, there are only two creation properties that you can use to control
+ * the creation of HDF5 attributes and links. The first creation property, the
+ * choice of a character encoding, applies to both attributes and links.
+ * The second creation property applies to links only, and advises the library
+ * to automatically create missing intermediate groups when creating new objects.
+ *
+ * \defgroup DAPL Dataset Access Properties
* \ingroup H5P
- * \defgroup FCPL File Creation Properties
+ * Use dataset access properties to modify the default behavior of the HDF5
+ * library when accessing datasets. The properties include adjusting the size
+ * of the chunk cache, providing prefixes for external content and virtual
+ * dataset file paths, and controlling flush behavior, etc. These properties
+ * are \Emph{not} persisted with datasets, and can be adjusted at runtime before
+ * a dataset is created or opened.
+ *
+ * \defgroup DCPL Dataset Creation Properties
+ * \ingroup H5P
+ * Use dataset creation properties to control aspects of dataset creation such
+ * as fill time, storage layout, compression methods, etc.
+ * Unlike dataset access and transfer properties, creation properties \Emph{are}
+ * stored with the dataset, and cannot be changed once a dataset has been
+ * created.
+ *
+ * \defgroup DXPL Dataset Transfer Properties
* \ingroup H5P
+ * Use dataset transfer properties to customize certain aspects of reading
+ * and writing datasets such as transformations, MPI-IO I/O mode, error
+ * detection, etc. These properties are \Emph{not} persisted with datasets,
+ * and can be adjusted at runtime before a dataset is read or written.
+ *
* \defgroup FAPL File Access Properties
* \ingroup H5P
- * \defgroup GCPL Group Creation Properties
+ * Use file access properties to modify the default behavior of the HDF5
+ * library when accessing files. The properties include selecting a virtual
+ * file driver (VFD), configuring the metadata cache (MDC), control
+ * file locking, etc. These properties are \Emph{not} persisted with files, and
+ * can be adjusted at runtime before a file is created or opened.
+ *
+ * \defgroup FCPL File Creation Properties
* \ingroup H5P
- * \defgroup ALCAPL Attribute and Link Creation Properties
+ * Use file creation properties to control aspects of file creation such
+ * as setting a file space management strategy or creating a user block.
+ * Unlike file access properties, creation properties \Emph{are}
+ * stored with the file, and cannot be changed once a file has been
+ * created.
+ *
+ * \defgroup GAPL General Access Properties
* \ingroup H5P
- * \defgroup LAPL Link Access Properties
+ * \todo Should this be as standalone page?
+ *
+ * \defgroup GCPL Group Creation Properties
* \ingroup H5P
- * \defgroup DCPL Dataset Creation Properties
+ * Use group creation properties to control aspects of group creation such
+ * as storage layout, compression, and link creation order tracking.
+ * Unlike file access properties, creation properties \Emph{are}
+ * stored with the group, and cannot be changed once a group has been
+ * created.
+ *
+ * \defgroup GPLO General Property List Operations
* \ingroup H5P
- * \defgroup DAPL Dataset Access Properties
+ *
+ * Use the functions in this module to manage HDF5 property lists.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \defgroup GPLOA General Property List Operations (Advanced)
* \ingroup H5P
- * \defgroup DXPL Dataset Transfer Properties
+ *
+ * You can create and customize user-defined property list classes using the
+ * functions described below. Arbitrary user-defined properties can also
+ * be inserted into existing property lists as so-called temporary properties.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ *
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c create_class
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c read_class
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5P_examples.c update_class
+ * </td>
+ * <td>
+ * \snippet{lineno} H5P_examples.c delete_class
+ * </td>
+ * </tr>
+ * </table>
+ *
+ * \defgroup LAPL Link Access Properties
* \ingroup H5P
+ *
+ *
+ * \defgroup MAPL Map Access Properties
+ * \ingroup H5P
+
* \defgroup OCPL Object Creation Properties
* \ingroup H5P
+ *
+ *
* \defgroup OCPPL Object Copy Properties
* \ingroup H5P
- * \defgroup GACPL General Access Properties
- * \ingroup H5P
- * \defgroup MAPL Map Access Properties
- * \ingroup H5P
+ *
+ *
*/
#endif /* H5Pmodule_H */
diff --git a/src/H5Pocpl.c b/src/H5Pocpl.c
index edb0cca..e442030 100644
--- a/src/H5Pocpl.c
+++ b/src/H5Pocpl.c
@@ -940,6 +940,8 @@ H5Pget_filter_by_id2(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
H5TRACE8("e", "iZfx*zxzxx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name, filter_config);
/* Check args */
+ if (id < 0 || id > H5Z_FILTER_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range")
if (cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so
@@ -1838,6 +1840,8 @@ H5Pget_filter_by_id1(hid_t plist_id, H5Z_filter_t id, unsigned int *flags /*out*
H5TRACE7("e", "iZfx*zxzx", plist_id, id, flags, cd_nelmts, cd_values, namelen, name);
/* Check args */
+ if (id < 0 || id > H5Z_FILTER_MAX)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "filter ID value out of range")
if (cd_nelmts || cd_values) {
/*
* It's likely that users forget to initialize this on input, so
diff --git a/src/H5Ppublic.h b/src/H5Ppublic.h
index 72a2358..ed61646 100644
--- a/src/H5Ppublic.h
+++ b/src/H5Ppublic.h
@@ -22,16 +22,17 @@
/* Public headers needed by this file */
#include "H5public.h"
-#include "H5ACpublic.h"
-#include "H5Dpublic.h"
-#include "H5Fpublic.h"
-#include "H5FDpublic.h"
-#include "H5Ipublic.h"
-#include "H5Lpublic.h"
-#include "H5Opublic.h"
-#include "H5MMpublic.h"
-#include "H5Tpublic.h"
-#include "H5Zpublic.h"
+#include "H5ACpublic.h" /* Metadata cache */
+#include "H5Dpublic.h" /* Datasets */
+#include "H5Fpublic.h" /* Files */
+#include "H5FDpublic.h" /* File drivers */
+#include "H5Ipublic.h" /* ID management */
+#include "H5Lpublic.h" /* Links */
+#include "H5MMpublic.h" /* Memory management */
+#include "H5Opublic.h" /* Object headers */
+#include "H5Spublic.h" /* Dataspaces */
+#include "H5Tpublic.h" /* Datatypes */
+#include "H5Zpublic.h" /* Data filters */
/*****************/
/* Public Macros */
@@ -100,7 +101,9 @@
#define H5P_CRT_ORDER_TRACKED 0x0001
#define H5P_CRT_ORDER_INDEXED 0x0002
-/* Default value for all property list classes */
+/**
+ * Default value of type \ref hid_t for all property list classes
+ */
#define H5P_DEFAULT 0 /* (hid_t) */
#ifdef __cplusplus
@@ -113,14 +116,23 @@ extern "C" {
/* Define property list class callback function pointer types */
//! <!-- [H5P_cls_create_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_cls_create_func_t)(hid_t prop_id, void *create_data);
//! <!-- [H5P_cls_create_func_t_snip] -->
//! <!-- [H5P_cls_copy_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_cls_copy_func_t)(hid_t new_prop_id, hid_t old_prop_id, void *copy_data);
//! <!-- [H5P_cls_copy_func_t_snip] -->
//! <!-- [H5P_cls_close_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_cls_close_func_t)(hid_t prop_id, void *close_data);
//! <!-- [H5P_cls_close_func_t_snip] -->
@@ -159,12 +171,25 @@ typedef herr_t (*H5P_prp_cb2_t)(hid_t prop_id, const char *name, size_t size, vo
typedef H5P_prp_cb1_t H5P_prp_create_func_t;
typedef H5P_prp_cb2_t H5P_prp_set_func_t;
typedef H5P_prp_cb2_t H5P_prp_get_func_t;
+//! <!-- [H5P_prp_encode_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_prp_encode_func_t)(const void *value, void **buf, size_t *size);
+//! <!-- [H5P_prp_encode_func_t_snip] -->
+//! <!-- [H5P_prp_decode_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_prp_decode_func_t)(const void **buf, void *value);
+//! <!-- [H5P_prp_decode_func_t_snip] -->
typedef H5P_prp_cb2_t H5P_prp_delete_func_t;
typedef H5P_prp_cb1_t H5P_prp_copy_func_t;
//! <!-- [H5P_prp_compare_func_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef int (*H5P_prp_compare_func_t)(const void *value1, const void *value2, size_t size);
//! <!-- [H5P_prp_compare_func_t_snip] -->
@@ -172,6 +197,9 @@ typedef H5P_prp_cb1_t H5P_prp_close_func_t;
/* Define property list iteration function type */
//! <!-- [H5P_iterate_t_snip] -->
+/**
+ * \todo Document me!
+ */
typedef herr_t (*H5P_iterate_t)(hid_t id, const char *name, void *iter_data);
//! <!-- [H5P_iterate_t_snip] -->
@@ -2212,7 +2240,7 @@ H5_DLL herr_t H5Pset_attr_creation_order(hid_t plist_id, unsigned crt_order_flag
*/
H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, unsigned min_dense);
/**
- * \ingroup OCPL
+ * \ingroup DCPL
*
* \brief Sets deflate (GNU gzip) compression method and compression level
*
@@ -2221,6 +2249,8 @@ H5_DLL herr_t H5Pset_attr_phase_change(hid_t plist_id, unsigned max_compact, uns
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_deflate() sets the deflate compression method and the
* compression level, \p level, for a dataset or group creation
* property list, \p plist_id.
@@ -5212,9 +5242,37 @@ H5_DLL herr_t H5Pset_small_data_block_size(hid_t fapl_id, hsize_t size);
*/
H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_info);
+/**
+ * \ingroup FAPL
+ *
+ * \brief Query the capability flags for the VOL connector that will be used
+ * with this file access property list (FAPL).
+ *
+ * \fapl_id{plist_id}
+ * \param[out] cap_flags Flags that indicate the VOL connector capabilities
+ *
+ * \return \herr_t
+ *
+ * \details H5Pget_vol_cap_flags() queries the current VOL connector information
+ * for a FAPL to retrieve the capability flags for the VOL
+ * connector stack, as will be used by a file open or create
+ * operation that uses this FAPL.
+ *
+ * \note This routine supports the use of the HDF5_VOL_CONNECTOR environment
+ * variable to override the VOL connector set programmatically for the
+ * FAPL (with H5Pset_vol).
+ *
+ * \note The H5VL_CAP_FLAG_ASYNC flag can be checked to see if asynchronous
+ * operations are supported by the VOL connector stack.
+ *
+ * \since 1.13.0
+ *
+ */
+H5_DLL herr_t H5Pget_vol_cap_flags(hid_t plist_id, unsigned *cap_flags);
+
#ifdef H5_HAVE_PARALLEL
/**
- * \ingroup GACPL
+ * \ingroup GAPL
*
* \brief Sets metadata I/O mode for read operations to collective or independent (default)
*
@@ -5283,7 +5341,7 @@ H5_DLL herr_t H5Pset_vol(hid_t plist_id, hid_t new_vol_id, const void *new_vol_i
*/
H5_DLL herr_t H5Pset_all_coll_metadata_ops(hid_t plist_id, hbool_t is_collective);
/**
- * \ingroup GACPL
+ * \ingroup GAPL
*
* \brief Retrieves metadata read mode setting
*
@@ -6247,6 +6305,8 @@ H5_DLL herr_t H5Pset_fill_value(hid_t plist_id, hid_t type_id, const void *value
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_shuffle() sets the shuffle filter, #H5Z_FILTER_SHUFFLE,
* in the dataset creation property list \p plist_id. The shuffle
* filter de-interlaces a block of data by reordering the bytes.
@@ -6318,6 +6378,8 @@ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_nbit() sets the N-Bit filter, #H5Z_FILTER_NBIT, in the
* dataset creation property list \p plist_id.
*
@@ -6340,10 +6402,10 @@ H5_DLL herr_t H5Pset_layout(hid_t plist_id, H5D_layout_t layout);
* <td>byte 0</td>
* </tr>
* <tr>
- * <td>????????</td>
- * <td>????SPPP</td>
- * <td>PPPPPPPP</td>
- * <td>PPPP????</td>
+ * <td> ???????? </td>
+ * <td> ????SPPP </td>
+ * <td> PPPPPPPP </td>
+ * <td> PPPP???? </td>
* </tr>
* </table>
* Note: S - sign bit, P - significant bit, ? - padding bit; For
@@ -6411,6 +6473,8 @@ H5_DLL herr_t H5Pset_nbit(hid_t plist_id);
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_scaleoffset() sets the scale-offset filter,
* #H5Z_FILTER_SCALEOFFSET, for a dataset.
*
@@ -6520,6 +6584,8 @@ H5_DLL herr_t H5Pset_scaleoffset(hid_t plist_id, H5Z_SO_scale_type_t scale_type,
*
* \return \herr_t
*
+ * \par_compr_note
+ *
* \details H5Pset_szip() sets an SZIP compression filter, #H5Z_FILTER_SZIP,
* for a dataset. SZIP is a compression method designed for use with
* scientific data.
@@ -7430,10 +7496,6 @@ H5_DLL size_t H5Pget_buffer(hid_t plist_id, void **tconv /*out*/, void **bkg /*o
* If an error occurs, the buffer pointed to by \p expression is
* unchanged, and the function returns a negative value.
*
- * \par Example
- * An example snippet from examples/h5_dtransform.c:
- * \snippet h5_dtransform.c H5Pget_data_transform_snip
- *
* \since 1.8.0
*
*/
@@ -8009,6 +8071,44 @@ H5_DLL herr_t H5Pget_mpio_actual_io_mode(hid_t plist_id, H5D_mpio_actual_io_mode
H5_DLL herr_t H5Pget_mpio_no_collective_cause(hid_t plist_id, uint32_t *local_no_collective_cause,
uint32_t *global_no_collective_cause);
#endif /* H5_HAVE_PARALLEL */
+/**
+ *
+ * \ingroup DXPL
+ *
+ * \brief Sets a hyperslab file selection for a dataset I/O operation
+ *
+ * \param[in] plist_id Property list identifier
+ * \param[in] rank Number of dimensions of selection
+ * \param[in] op Operation to perform on current selection
+ * \param[in] start Offset of start of hyperslab
+ * \param[in] stride Hyperslab stride
+ * \param[in] count Number of blocks included in hyperslab
+ * \param[in] block Size of block in hyperslab
+ *
+ * \return \herr_t
+ *
+ * \details H5Pset_dataset_io_hyperslab_selection() is designed to be used
+ * in conjunction with using #H5S_PLIST for the file dataspace
+ * ID when making a call to H5Dread() or H5Dwrite(). When used
+ * with #H5S_PLIST, the selection created by one or more calls to
+ * this routine is used for determining which dataset elements to
+ * access.
+ *
+ * \p rank is the dimensionality of the selection and determines
+ * the size of the \p start, \p stride, \p count, and \p block arrays.
+ * \p rank must be between 1 and #H5S_MAX_RANK, inclusive.
+ *
+ * The \p op, \p start, \p stride, \p count, and \p block parameters
+ * behave identically to their behavior for H5Sselect_hyperslab(),
+ * please see the documentation for that routine for details about
+ * their use.
+ *
+ * \since 1.13.0
+ *
+ */
+H5_DLL herr_t H5Pset_dataset_io_hyperslab_selection(hid_t plist_id, unsigned rank, H5S_seloper_t op,
+ const hsize_t start[], const hsize_t stride[],
+ const hsize_t count[], const hsize_t block[]);
/* Link creation property list (LCPL) routines */
/**
@@ -9398,9 +9498,6 @@ H5_DLL herr_t H5Pset_mcdt_search_cb(hid_t plist_id, H5O_mcdt_search_cb_t func, v
* The #H5P_prp_cb2_t is as follows:
* \snippet this H5P_prp_cb2_t_snip
*
- *
- * \cpp_c_api_note
- *
*/
/* Function prototypes */
@@ -9514,8 +9611,7 @@ H5_DLL herr_t H5Pregister1(hid_t cls_id, const char *name, size_t size, void *de
*
* The #H5P_prp_cb2_t is as follows:
* \snippet this H5P_prp_cb2_t_snip
-
- * \cpp_c_api_note
+ *
*/
H5_DLL herr_t H5Pinsert1(hid_t plist_id, const char *name, size_t size, void *value,
H5P_prp_set_func_t prp_set, H5P_prp_get_func_t prp_get,
diff --git a/src/H5R.c b/src/H5R.c
index 1413c1c..102af7f 100644
--- a/src/H5R.c
+++ b/src/H5R.c
@@ -79,14 +79,16 @@ static hid_t H5R__open_attr_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t
herr_t
H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_ptr)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t obj_type; /* Object type of loc_id */
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "i*si*Rr", loc_id, name, oapl_id, ref_ptr);
@@ -121,9 +123,12 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Set location parameters */
@@ -132,15 +137,18 @@ H5Rcreate_object(hid_t loc_id, const char *name, hid_t oapl_id, H5R_ref_t *ref_p
loc_params.loc_data.loc_by_name.lapl_id = oapl_id;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Create the reference (do not pass filename, since file_id is attached) */
HDmemset(ref_ptr, 0, H5R_REF_BUF_SIZE);
- if (H5R__create_object((const H5O_token_t *)&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) <
- 0)
+ if (H5R__create_object(&obj_token, cont_info.token_size, (H5R_ref_priv_t *)ref_ptr) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTCREATE, FAIL, "unable to create object reference")
/* Attach loc_id to reference and hold reference to it */
@@ -167,15 +175,17 @@ done:
herr_t
H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id, H5R_ref_t *ref_ptr)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t obj_type; /* Object type of loc_id */
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- struct H5S_t * space = NULL; /* Pointer to dataspace containing region */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ struct H5S_t * space = NULL; /* Pointer to dataspace containing region */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*sii*Rr", loc_id, name, space_id, oapl_id, ref_ptr);
@@ -185,7 +195,7 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid reference pointer")
if (!name || !*name)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "no name given")
- if ((space_id == H5I_INVALID_HID) || (space_id == H5S_ALL))
+ if ((space_id == H5I_INVALID_HID) || (space_id == H5S_ALL) || (space_id == H5S_BLOCK))
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "reference region dataspace id must be valid")
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataspace")
@@ -214,9 +224,12 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Set location parameters */
@@ -225,9 +238,13 @@ H5Rcreate_region(hid_t loc_id, const char *name, hid_t space_id, hid_t oapl_id,
loc_params.loc_data.loc_by_name.lapl_id = oapl_id;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Create the reference (do not pass filename, since file_id is attached) */
@@ -259,14 +276,16 @@ done:
herr_t
H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl_id, H5R_ref_t *ref_ptr)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t obj_type; /* Object type of loc_id */
- hid_t file_id = H5I_INVALID_HID; /* File ID */
- H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t obj_type; /* Object type of loc_id */
+ hid_t file_id = H5I_INVALID_HID; /* File ID */
+ H5VL_object_t * vol_obj_file = NULL; /* Object of file_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "i*s*si*Rr", loc_id, name, attr_name, oapl_id, ref_ptr);
@@ -303,9 +322,12 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Set location parameters */
@@ -314,9 +336,13 @@ H5Rcreate_attr(hid_t loc_id, const char *name, const char *attr_name, hid_t oapl
loc_params.loc_data.loc_by_name.lapl_id = oapl_id;
loc_params.obj_type = obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Create the reference (do not pass filename, since file_id is attached) */
@@ -611,15 +637,16 @@ H5R__open_region_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, vo
hid_t loc_id; /* Reference location ID */
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 */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5I_type_t opened_type; /* Opened object type */
- void * opened_obj = NULL; /* Opened object */
- hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */
- H5S_t * space = NULL; /* Dataspace pointer (copy) */
- hid_t space_id = H5I_INVALID_HID; /* Dataspace 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_loc_params_t loc_params; /* Location parameters */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5I_type_t opened_type; /* Opened object type */
+ void * opened_obj = NULL; /* Opened object */
+ hid_t opened_obj_id = H5I_INVALID_HID; /* Opened object ID */
+ H5S_t * space = NULL; /* Dataspace pointer (copy) */
+ hid_t space_id = H5I_INVALID_HID; /* Dataspace ID */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
FUNC_ENTER_STATIC
@@ -662,10 +689,14 @@ H5R__open_region_api_common(H5R_ref_t *ref_ptr, hid_t rapl_id, hid_t oapl_id, vo
if (NULL == (opened_obj = H5VL_vol_object(opened_obj_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location 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 dataspace from object */
- if (H5VL_dataset_get(opened_obj, H5VL_DATASET_GET_SPACE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &space_id) < 0)
+ if (H5VL_dataset_get(opened_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get dataspace from dataset")
+ space_id = vol_cb_args.args.get_space.space_id;
if (NULL == (space = (struct H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a dataspace")
@@ -940,11 +971,12 @@ done:
herr_t
H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/)
{
- hid_t loc_id; /* Reference location ID */
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- herr_t ret_value = SUCCEED; /* Return value */
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE3("e", "*Rrix", ref_ptr, rapl_id, obj_type);
@@ -959,11 +991,10 @@ H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")
/* Retrieve loc_id from reference */
- if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr)))
/* Attempt to re-open file and pass rapl_id as a fapl_id */
if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, FAIL, "cannot re-open referenced file")
- }
/* Get object token */
if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
@@ -978,9 +1009,12 @@ H5Rget_obj_type3(H5R_ref_t *ref_ptr, hid_t rapl_id, H5O_type_t *obj_type /*out*/
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_TYPE;
+ vol_cb_args.args.get_type.obj_type = obj_type;
+
/* Retrieve object's type */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- obj_type) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type")
done:
@@ -1021,15 +1055,27 @@ H5Rget_file_name(const H5R_ref_t *ref_ptr, char *buf /*out*/, size_t size)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to retrieve file name")
}
else {
- H5VL_object_t *vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_t * vol_obj; /* Object of loc_id */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t file_name_len = 0; /* Length of file name */
/* Retrieve VOL file object */
if (NULL == (vol_obj = H5VL_vol_object(loc_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "invalid location identifier")
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL, H5I_FILE,
- size, buf, &ret_value) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = H5I_FILE;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = buf;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
+ /* Get file name */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "unable to get file name")
+
+ /* Set return value */
+ ret_value = (ssize_t)file_name_len;
}
done:
@@ -1049,11 +1095,13 @@ done:
ssize_t
H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t size)
{
- hid_t loc_id; /* Reference location ID */
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- ssize_t ret_value = 0; /* Return value */
+ hid_t loc_id; /* Reference location ID */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ size_t obj_name_len = 0; /* Length of object's name */
+ ssize_t ret_value = 0; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE4("Zs", "*Rrixz", ref_ptr, rapl_id, buf, size);
@@ -1068,11 +1116,10 @@ H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t siz
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, (-1), "not a property list")
/* Retrieve loc_id from reference */
- if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr))) {
+ if (H5I_INVALID_HID == (loc_id = H5R__get_loc_id((const H5R_ref_priv_t *)ref_ptr)))
/* Attempt to re-open file and pass rapl_id as a fapl_id */
if ((loc_id = H5R__reopen_file((H5R_ref_priv_t *)ref_ptr, rapl_id)) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTOPENFILE, (-1), "cannot re-open referenced file")
- }
/* Get object token */
if (H5R__get_obj_token((const H5R_ref_priv_t *)ref_ptr, &obj_token, NULL) < 0)
@@ -1087,11 +1134,19 @@ H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *buf /*out*/, size_t siz
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = H5I_get_type(loc_id);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_NAME;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = buf;
+ vol_cb_args.args.get_name.name_len = &obj_name_len;
+
/* Retrieve object's name */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value, buf, size) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)obj_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_obj_name() */
diff --git a/src/H5RS.c b/src/H5RS.c
index 96d55e7..65cfd38 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -316,8 +316,16 @@ H5RS_wrap(const char *s)
if (NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed")
- /* Set the internal fields */
- ret_value->s = (char *)s;
+ /* Set the internal fields
+ *
+ * We ignore warnings about storing a const char pointer in the struct
+ * since we never modify or free the string when the wrapped struct
+ * field is set to TRUE.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ ret_value->s = (char *)s;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
+
ret_value->len = HDstrlen(s);
ret_value->end = ret_value->s + ret_value->len;
@@ -349,7 +357,7 @@ done:
* format_templ in the code below, but early (4.4.7, at least) gcc only
* allows diagnostic pragmas to be toggled outside of functions.
*/
-H5_GCC_DIAG_OFF("format-nonliteral")
+H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
H5_ATTR_FORMAT(printf, 2, 3)
herr_t
H5RS_asprintf_cat(H5RS_str_t *rs, const char *fmt, ...)
@@ -392,7 +400,7 @@ H5RS_asprintf_cat(H5RS_str_t *rs, const char *fmt, ...)
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5RS_asprintf_cat() */
-H5_GCC_DIAG_ON("format-nonliteral")
+H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/*-------------------------------------------------------------------------
* Function: H5RS_acat
@@ -698,7 +706,7 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2)
const H5RS_str_t *rs; IN: Ref-counted string to compute length of
RETURNS
- Returns non-negative value on success, negative value on failure
+ Returns non-negative value on success, can't fail
DESCRIPTION
Compute the length of a ref-counted string. [same as strlen()]
GLOBAL VARIABLES
@@ -706,7 +714,7 @@ H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2)
EXAMPLES
REVISION LOG
--------------------------------------------------------------------------*/
-ssize_t
+size_t
H5RS_len(const H5RS_str_t *rs)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
@@ -715,7 +723,7 @@ H5RS_len(const H5RS_str_t *rs)
HDassert(rs);
HDassert(rs->s);
- FUNC_LEAVE_NOAPI((ssize_t)HDstrlen(rs->s))
+ FUNC_LEAVE_NOAPI(HDstrlen(rs->s))
} /* end H5RS_len() */
/*--------------------------------------------------------------------------
diff --git a/src/H5RSprivate.h b/src/H5RSprivate.h
index 7d2b728..ebca1a3 100644
--- a/src/H5RSprivate.h
+++ b/src/H5RSprivate.h
@@ -53,7 +53,7 @@ H5_DLL herr_t H5RS_acat(H5RS_str_t *rs, const char *s);
H5_DLL herr_t H5RS_ancat(H5RS_str_t *rs, const char *s, size_t len);
H5_DLL herr_t H5RS_aputc(H5RS_str_t *rs, int c);
H5_DLL int H5RS_cmp(const H5RS_str_t *rs1, const H5RS_str_t *rs2);
-H5_DLL ssize_t H5RS_len(const H5RS_str_t *rs);
+H5_DLL size_t H5RS_len(const H5RS_str_t *rs);
H5_DLL char * H5RS_get_str(const H5RS_str_t *rs);
H5_DLL unsigned H5RS_get_count(const H5RS_str_t *rs);
diff --git a/src/H5Rdeprec.c b/src/H5Rdeprec.c
index d5f5a7d..3f1d70f 100644
--- a/src/H5Rdeprec.c
+++ b/src/H5Rdeprec.c
@@ -94,7 +94,8 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref
hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
H5VL_object_t * vol_obj_file = NULL;
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- herr_t ret_value = SUCCEED;
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
@@ -119,9 +120,12 @@ H5R__decode_token_compat(H5VL_object_t *vol_obj, H5I_type_t type, H5R_type_t ref
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
if (ref_type == H5R_OBJECT1) {
@@ -240,13 +244,14 @@ done:
H5G_obj_t
H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5O_type_t obj_type; /* Object type */
- const unsigned char *buf = (const unsigned char *)ref; /* Reference buffer */
- H5G_obj_t ret_value; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference buffer */
+ H5O_type_t obj_type = H5O_TYPE_UNKNOWN; /* Type of the referenced object */
+ H5G_obj_t ret_value; /* Return value */
FUNC_ENTER_API(H5G_UNKNOWN)
H5TRACE3("Go", "iRt*x", id, ref_type, ref);
@@ -274,9 +279,12 @@ H5Rget_obj_type1(hid_t id, H5R_type_t ref_type, const void *ref)
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_TYPE;
+ vol_cb_args.args.get_type.obj_type = &obj_type;
+
/* Retrieve object's type */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &obj_type) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5G_UNKNOWN, "can't retrieve object type")
/* Set return value */
@@ -365,15 +373,17 @@ done:
herr_t
H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t space_id)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
- void * vol_obj_file = NULL;
- unsigned char * buf = (unsigned char *)ref; /* Return reference pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_specific_args_t obj_spec_vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t file_get_vol_cb_args; /* Arguments to VOL callback */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
+ void * vol_obj_file = NULL;
+ unsigned char * buf = (unsigned char *)ref; /* Return reference pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE5("e", "*xi*sRti", ref, loc_id, name, ref_type, space_id);
@@ -417,9 +427,13 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
loc_params.loc_data.loc_by_name.lapl_id = H5P_LINK_ACCESS_DEFAULT;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ obj_spec_vol_cb_args.op_type = H5VL_OBJECT_LOOKUP;
+ obj_spec_vol_cb_args.args.lookup.token_ptr = &obj_token;
+
/* Get the object token */
- if (H5VL_object_specific(vol_obj, &loc_params, H5VL_OBJECT_LOOKUP, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &obj_token) < 0)
+ if (H5VL_object_specific(vol_obj, &loc_params, &obj_spec_vol_cb_args, H5P_DATASET_XFER_DEFAULT,
+ H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to retrieve object token")
/* Get the file for the object */
@@ -430,9 +444,12 @@ H5Rcreate(void *ref, hid_t loc_id, const char *name, H5R_type_t ref_type, hid_t
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ file_get_vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ file_get_vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &file_get_vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "unable to get container info")
/* Create reference */
@@ -483,12 +500,13 @@ done:
herr_t
H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj_type /*out*/)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API(FAIL)
H5TRACE4("e", "iRt*xx", id, ref_type, ref, obj_type);
@@ -516,9 +534,12 @@ H5Rget_obj_type2(hid_t id, H5R_type_t ref_type, const void *ref, H5O_type_t *obj
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_TYPE;
+ vol_cb_args.args.get_type.obj_type = obj_type;
+
/* Retrieve object's type */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- obj_type) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't retrieve object type")
done:
@@ -612,12 +633,13 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
void * vol_obj_file = NULL; /* VOL file */
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- H5F_t * f = NULL; /* Native file */
- size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; /* Reference buffer size */
- H5S_t * space = NULL; /* Dataspace object */
- hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
- const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
- hid_t ret_value; /* Return value */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5F_t * f = NULL; /* Native file */
+ size_t buf_size = H5R_DSET_REG_REF_BUF_SIZE; /* Reference buffer size */
+ H5S_t * space = NULL; /* Dataspace object */
+ hid_t file_id = H5I_INVALID_HID; /* File ID for region reference */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
+ hid_t ret_value; /* Return value */
FUNC_ENTER_API(H5I_INVALID_HID)
H5TRACE3("i", "iRt*x", id, ref_type, ref);
@@ -658,9 +680,12 @@ H5Rget_region(hid_t id, H5R_type_t ref_type, const void *ref)
if (NULL == (vol_obj_file = H5VL_vol_object(file_id)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "invalid location identifier")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get((const H5VL_object_t *)vol_obj_file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, &cont_info) < 0)
+ if (H5VL_file_get(vol_obj_file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "unable to get container info")
/* Retrieve file from VOL object */
@@ -695,12 +720,14 @@ done:
ssize_t
H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name /*out*/, size_t size)
{
- H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
- H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
- H5VL_loc_params_t loc_params; /* Location parameters */
- H5O_token_t obj_token = {0}; /* Object token */
- const unsigned char *buf = (const unsigned char *)ref; /* Reference pointer */
- ssize_t ret_value = -1; /* Return value */
+ H5VL_object_t * vol_obj = NULL; /* Object of loc_id */
+ H5I_type_t vol_obj_type = H5I_BADID; /* Object type of loc_id */
+ H5VL_object_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ H5VL_loc_params_t loc_params; /* Location parameters */
+ H5O_token_t obj_token = {0}; /* Object token */
+ const unsigned char * buf = (const unsigned char *)ref; /* Reference pointer */
+ size_t obj_name_len = 0; /* Length of object's name */
+ ssize_t ret_value = -1; /* Return value */
FUNC_ENTER_API((-1))
H5TRACE5("Zs", "iRt*xxz", id, ref_type, ref, name, size);
@@ -728,11 +755,19 @@ H5Rget_name(hid_t id, H5R_type_t ref_type, const void *ref, char *name /*out*/,
loc_params.loc_data.loc_by_token.token = &obj_token;
loc_params.obj_type = vol_obj_type;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_OBJECT_GET_NAME;
+ vol_cb_args.args.get_name.buf_size = size;
+ vol_cb_args.args.get_name.buf = name;
+ vol_cb_args.args.get_name.name_len = &obj_name_len;
+
/* Retrieve object's name */
- if (H5VL_object_get(vol_obj, &loc_params, H5VL_OBJECT_GET_NAME, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value, name, size) < 0)
+ if (H5VL_object_get(vol_obj, &loc_params, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, (-1), "can't retrieve object name")
+ /* Set return value */
+ ret_value = (ssize_t)obj_name_len;
+
done:
FUNC_LEAVE_API(ret_value)
} /* end H5Rget_name() */
diff --git a/src/H5Rint.c b/src/H5Rint.c
index b714f09..7ee4ecc 100644
--- a/src/H5Rint.c
+++ b/src/H5Rint.c
@@ -588,11 +588,18 @@ H5R__reopen_file(H5R_ref_priv_t *ref, hid_t fapl_id)
supported = 0;
if (H5VL_introspect_opt_query(vol_obj, H5VL_SUBCLS_FILE, H5VL_NATIVE_FILE_POST_OPEN, &supported) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, H5I_INVALID_HID, "can't check for 'post open' operation")
- if (supported & H5VL_OPT_QUERY_SUPPORTED)
- if (H5VL_file_optional(vol_obj, H5VL_NATIVE_FILE_POST_OPEN, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL) < 0)
+ if (supported & H5VL_OPT_QUERY_SUPPORTED) {
+ H5VL_optional_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_NATIVE_FILE_POST_OPEN;
+ vol_cb_args.args = NULL;
+
+ /* Make the 'post open' callback */
+ if (H5VL_file_optional(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTINIT, H5I_INVALID_HID,
"unable to make file 'post open' callback")
+ } /* end if */
/* Attach loc_id to reference */
if (H5R__set_loc_id((H5R_ref_priv_t *)ref, ret_value, FALSE, TRUE) < 0)
@@ -1143,7 +1150,7 @@ H5R__encode_obj_token(const H5O_token_t *obj_token, size_t token_size, unsigned
/* Encode token */
H5MM_memcpy(p, obj_token, token_size);
}
- *nalloc = token_size + H5_SIZEOF_UINT8_T;
+ *nalloc = token_size + sizeof(uint8_t);
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5R__encode_obj_token() */
@@ -1171,7 +1178,7 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj
HDassert(token_size);
/* Don't decode if buffer size isn't big enough */
- if (*nbytes < H5_SIZEOF_UINT8_T)
+ if (*nbytes < sizeof(uint8_t))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
/* Get token size */
@@ -1185,7 +1192,7 @@ H5R__decode_obj_token(const unsigned char *buf, size_t *nbytes, H5O_token_t *obj
/* Decode token */
H5MM_memcpy(obj_token, p, *token_size);
- *nbytes = (size_t)(*token_size + H5_SIZEOF_UINT8_T);
+ *nbytes = (size_t)(*token_size + sizeof(uint8_t));
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1218,7 +1225,7 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
"Cannot determine amount of space needed for serializing selection")
/* Don't encode if buffer size isn't big enough or buffer is empty */
- if (buf && *nalloc >= ((size_t)buf_size + 2 * H5_SIZEOF_UINT32_T)) {
+ if (buf && *nalloc >= ((size_t)buf_size + 2 * sizeof(uint32_t))) {
int rank;
p = (uint8_t *)buf;
@@ -1234,7 +1241,7 @@ H5R__encode_region(H5S_t *space, unsigned char *buf, size_t *nalloc)
if (H5S_SELECT_SERIALIZE(space, (unsigned char **)&p) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "can't serialize selection")
} /* end if */
- *nalloc = (size_t)buf_size + 2 * H5_SIZEOF_UINT32_T;
+ *nalloc = (size_t)buf_size + 2 * sizeof(uint32_t);
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1265,16 +1272,16 @@ H5R__decode_region(const unsigned char *buf, size_t *nbytes, H5S_t **space_ptr)
HDassert(space_ptr);
/* Don't decode if buffer size isn't big enough */
- if (*nbytes < (2 * H5_SIZEOF_UINT32_T))
+ if (*nbytes < (2 * sizeof(uint32_t)))
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDECODE, FAIL, "Buffer size is too small")
/* Decode the selection size */
UINT32DECODE(p, buf_size);
- buf_size += H5_SIZEOF_UINT32_T;
+ buf_size += sizeof(uint32_t);
/* Decode the extent rank */
UINT32DECODE(p, rank);
- buf_size += H5_SIZEOF_UINT32_T;
+ buf_size += sizeof(uint32_t);
/* Don't decode if buffer size isn't big enough */
if (*nbytes < buf_size)
diff --git a/src/H5Rmodule.h b/src/H5Rmodule.h
index 2a34d56..fe28bb2 100644
--- a/src/H5Rmodule.h
+++ b/src/H5Rmodule.h
@@ -27,9 +27,32 @@
/**
* \defgroup H5R H5R
- * \brief Reference Interface
- * \details The HDF5 Reference Interface, H5R, provides a mechanism for managing
- * HDF5 referenced objects.
+ *
+ * Use the functions in this module to manage HDF5 references. Referents can
+ * be HDF5 objects, attributes, and selections on datasets a.k.a. dataset
+ * regions.
+ *
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5R_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5R_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5R_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5R_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
*/
#endif /* H5Rmodule_H */
diff --git a/src/H5Rpkg.h b/src/H5Rpkg.h
index ee5fb71..09144f9 100644
--- a/src/H5Rpkg.h
+++ b/src/H5Rpkg.h
@@ -43,7 +43,7 @@
#define H5R_REF_ATTRNAME(x) ((x)->info.attr.name)
/* Header size */
-#define H5R_ENCODE_HEADER_SIZE (2 * H5_SIZEOF_UINT8_T)
+#define H5R_ENCODE_HEADER_SIZE (2 * sizeof(uint8_t))
/****************************/
/* Package Private Typedefs */
diff --git a/src/H5Rpublic.h b/src/H5Rpublic.h
index b33960e..ef798ea 100644
--- a/src/H5Rpublic.h
+++ b/src/H5Rpublic.h
@@ -30,9 +30,11 @@
#define H5R_OBJ_REF_BUF_SIZE sizeof(haddr_t)
#define H5R_DSET_REG_REF_BUF_SIZE (sizeof(haddr_t) + 4)
-/* Default reference buffer size.
- * Note! Be careful with the sizes of the references because they should really
- * depend on the run-time values in the file.
+/**
+ * Default reference buffer size.
+ *
+ * \internal Note! Be careful with the sizes of the references because they
+ * should really depend on the run-time values in the file.
*/
#define H5R_REF_BUF_SIZE (64)
@@ -560,6 +562,7 @@ H5_DLL ssize_t H5Rget_obj_name(H5R_ref_t *ref_ptr, hid_t rapl_id, char *name, si
*/
H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t size);
+/// \cond DEV
/* API Wrappers for async routines */
/* (Must be defined _after_ the function prototype) */
/* (And must only defined when included in application code, not the library) */
@@ -574,6 +577,7 @@ H5_DLL ssize_t H5Rget_attr_name(const H5R_ref_t *ref_ptr, char *name, size_t siz
#define H5Ropen_region_async_wrap H5_NO_EXPAND(H5Ropen_region_async)
#define H5Ropen_attr_async_wrap H5_NO_EXPAND(H5Ropen_attr_async)
#endif /* H5R_MODULE */
+/// \endcond
/* Symbols defined for compatibility with previous versions of the HDF5 API.
*
diff --git a/src/H5SL.c b/src/H5SL.c
index 166019b..b4fbf99 100644
--- a/src/H5SL.c
+++ b/src/H5SL.c
@@ -36,13 +36,6 @@
* skip list. The implementation in that document hurts
* performance, at least for integer keys. -NAF)
*
- * (Also, this implementation has a couple of home-grown
- * optimizations, including setting the "update" vector to the
- * actual 'forward' pointer to update, instead of the node
- * containing the forward pointer -QAK
- * -No longer uses update vector, as insertions/deletions are now
- * always at level 0. -NAF)
- *
* (Note: This implementation does not have the information for
* implementing the "Linear List Operations" (like insert/delete/
* search by position) in section 3.4 of "A Skip List Cookbook",
@@ -71,25 +64,14 @@
/* Define the code template for searches for the "OP" in the H5SL_LOCATE macro */
#define H5SL_LOCATE_SEARCH_FOUND(SLIST, X, I) \
{ \
- HDassert(!X->removed); \
- HGOTO_DONE(X->item); \
- } /* end block */
-
-/* Define the code template for deferred removals for the "OP" in the
- * H5SL_LOCATE macro */
-#define H5SL_LOCATE_SEARCH_DEFER_REMOVE_FOUND(SLIST, X, I) \
- { \
- HDassert(!X->removed); \
- X->removed = TRUE; \
HGOTO_DONE(X->item); \
- } /* end block */
+ }
/* Define the code template for finds for the "OP" in the H5SL_LOCATE macro */
#define H5SL_LOCATE_FIND_FOUND(SLIST, X, I) \
{ \
- HDassert(!X->removed); \
HGOTO_DONE(X); \
- } /* end block */
+ }
/* Define a code template for comparing scalar keys for the "CMP" in the H5SL_LOCATE macro */
#define H5SL_LOCATE_SCALAR_CMP(SLIST, TYPE, PNODE, PKEY, HASHVAL) (*(TYPE *)((PNODE)->key) < *(TYPE *)PKEY)
@@ -155,51 +137,19 @@
H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) { \
X = X->forward[_i]; \
_count++; \
- } /* end while */ \
- } /* end for */ \
+ } \
+ } \
X = X->forward[0]; \
if (X != NULL && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, X, KEY, HASHVAL)) { \
/* What to do when a node is found */ \
H5_GLUE3(H5SL_LOCATE_, OP, _FOUND)(SLIST, X, _i) \
- } /* end if */ \
- }
-
-/* Macro used to find node for operation, if there may be "removed" nodes in the
- * list (whose keys cannot be read) */
-#define H5SL_LOCATE_SAFE(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
- { \
- int _i; /* Local index variable */ \
- H5SL_node_t *_low = X; \
- H5SL_node_t *_high = NULL; \
- \
- H5_GLUE3(H5SL_LOCATE_, CMP, _HASHINIT) \
- (KEY, HASHVAL) for (_i = (int)SLIST->curr_level; _i >= 0; _i--) \
- { \
- X = _low->forward[_i]; \
- while (X != _high) { \
- if (!X->removed) { \
- if (H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X, KEY, HASHVAL)) \
- _low = X; \
- else \
- break; \
- } /* end if */ \
- X = X->forward[_i]; \
- } /* end while */ \
- _high = X; \
- if (X != NULL && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, X, KEY, HASHVAL)) { \
- /* What to do when a node is found */ \
- H5_GLUE3(H5SL_LOCATE_, OP, _FOUND)(SLIST, X, _i) break; \
- } /* end if */ \
- } /* end for */ \
+ } \
}
/* Macro used to find node for operation */
#define H5SL_LOCATE(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
{ \
- if ((SLIST)->safe_iterating) \
- H5SL_LOCATE_SAFE(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
- else \
- H5SL_LOCATE_OPT(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
+ H5SL_LOCATE_OPT(OP, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
}
/* Macro used to grow a node by 1. Does not update pointers. LVL is the current
@@ -209,7 +159,7 @@
/* Check if we need to increase allocation of forward pointers */ \
if (LVL + 1 >= 1u << X->log_nalloc) { \
H5SL_node_t **_tmp; \
- HDassert(LVL + 1 == 1u << X->log_nalloc); \
+ HDassert(LVL + 1 == 1U << X->log_nalloc); \
/* Double the amount of allocated space */ \
X->log_nalloc++; \
\
@@ -225,13 +175,13 @@
if (NULL == (H5SL_fac_g = (H5FL_fac_head_t **)H5MM_realloc( \
(void *)H5SL_fac_g, H5SL_fac_nalloc_g * sizeof(H5FL_fac_head_t *)))) \
HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, ERR, "memory allocation failed") \
- } /* end if */ \
+ } \
\
/* Create the new factory */ \
H5SL_fac_g[H5SL_fac_nused_g] = \
H5FL_fac_init((1u << H5SL_fac_nused_g) * sizeof(H5SL_node_t *)); \
H5SL_fac_nused_g++; \
- } /* end if */ \
+ } \
\
/* Allocate space for new forward pointers */ \
if (NULL == (_tmp = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[X->log_nalloc]))) \
@@ -239,7 +189,7 @@
H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL + 1) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc - 1], (void *)X->forward); \
X->forward = _tmp; \
- } /* end if */ \
+ } \
\
X->level++; \
}
@@ -251,7 +201,7 @@
/* Check if we can reduce the allocation of forward pointers */ \
if (LVL <= 1u << (X->log_nalloc - 1)) { \
H5SL_node_t **_tmp; \
- HDassert(LVL == 1u << (X->log_nalloc - 1)); \
+ HDassert(LVL == 1U << (X->log_nalloc - 1)); \
X->log_nalloc--; \
\
/* Allocate space for new forward pointers */ \
@@ -260,7 +210,7 @@
H5MM_memcpy((void *)_tmp, (const void *)X->forward, (LVL) * sizeof(H5SL_node_t *)); \
X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[X->log_nalloc + 1], (void *)X->forward); \
X->forward = _tmp; \
- } /* end if */ \
+ } \
\
X->level--; \
}
@@ -284,7 +234,7 @@
else { \
HDassert(_lvl < (size_t)SLIST->curr_level); \
X->forward[_lvl + 1] = PREV->forward[_lvl + 1]; \
- } /* end else */ \
+ } \
PREV->forward[_lvl + 1] = X; \
}
@@ -322,7 +272,7 @@
if (!_drop) \
_drop = X; \
break; \
- } /* end if */ \
+ } \
\
/* Check if this node is the start of the next gap */ \
if (!_drop && !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) \
@@ -337,7 +287,7 @@
break; \
} \
X = X->forward[_i]; \
- } /* end for */ \
+ } \
HDassert(!_drop->forward[_i] || \
!H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \
\
@@ -350,7 +300,7 @@
/* Prepare to drop down */ \
X = _last = _drop; \
_next = _drop->forward[_i]; \
- } /* end for */ \
+ } \
\
if (_next && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, _next, KEY, HASHVAL)) \
HGOTO_ERROR(H5E_SLIST, H5E_CANTINSERT, NULL, "can't insert duplicate key") \
@@ -359,172 +309,167 @@
/* Macro used to remove node */
#define H5SL_REMOVE(CMP, SLIST, X, TYPE, KEY, HASHVAL) \
{ \
- /* Check for deferred removal */ \
- if (SLIST->safe_iterating) \
- H5SL_LOCATE(SEARCH_DEFER_REMOVE, CMP, SLIST, X, TYPE, KEY, HASHVAL) \
- else { \
- H5SL_node_t *_last = X; /* Lowest node in the current gap */ \
- H5SL_node_t *_llast = X; /* Lowest node in the previous gap */ \
- H5SL_node_t *_next = NULL; /* Highest node in the currect gap */ \
- H5SL_node_t *_drop = NULL; /* Low node of the gap to drop into */ \
- H5SL_node_t *_ldrop = NULL; /* Low node of gap before the one to drop into */ \
- H5SL_node_t *_head = SLIST->header; /* Head of the skip list */ \
- int _count; /* Number of nodes in the current gap */ \
- int _i = (int)SLIST->curr_level; \
+ H5SL_node_t *_last = X; /* Lowest node in the current gap */ \
+ H5SL_node_t *_llast = X; /* Lowest node in the previous gap */ \
+ H5SL_node_t *_next = NULL; /* Highest node in the currect gap */ \
+ H5SL_node_t *_drop = NULL; /* Low node of the gap to drop into */ \
+ H5SL_node_t *_ldrop = NULL; /* Low node of gap before the one to drop into */ \
+ H5SL_node_t *_head = SLIST->header; /* Head of the skip list */ \
+ int _count; /* Number of nodes in the current gap */ \
+ int _i = (int)SLIST->curr_level; \
\
- if (_i < 0) \
- HGOTO_DONE(NULL); \
+ if (_i < 0) \
+ HGOTO_DONE(NULL); \
\
- H5_GLUE3(H5SL_LOCATE_, CMP, _HASHINIT) \
- (KEY, HASHVAL) \
+ H5_GLUE3(H5SL_LOCATE_, CMP, _HASHINIT) \
+ (KEY, HASHVAL) \
\
- /* Find the gap to drop in to at the highest level */ \
- while (X && (!X->key || H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X, KEY, HASHVAL))) \
- { \
- _llast = _last; \
- _last = X; \
- X = X->forward[_i]; \
- } \
- _next = X; \
+ /* Find the gap to drop in to at the highest level */ \
+ while (X && (!X->key || H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X, KEY, HASHVAL))) \
+ { \
+ _llast = _last; \
+ _last = X; \
+ X = X->forward[_i]; \
+ } \
+ _next = X; \
\
- /* Main loop */ \
- for (_i--; _i >= 0; _i--) { \
- /* Search for the node to drop into, also count the number of */ \
- /* nodes of height _i in this gap and keep track of of the node */ \
- /* before the one to drop into (_ldrop will become _llast, */ \
- /* _drop will become _last). */ \
- X = _ldrop = _last; \
- _drop = NULL; \
- for (_count = 0;; _count++) { \
- /* Terminate if this is the last node in the gap */ \
- if (X->forward[_i] == _next) { \
- if (!_drop) \
- _drop = X; \
- break; \
- } /* end if */ \
+ /* Main loop */ \
+ for (_i--; _i >= 0; _i--) { \
+ /* Search for the node to drop into, also count the number of */ \
+ /* nodes of height _i in this gap and keep track of of the node */ \
+ /* before the one to drop into (_ldrop will become _llast, */ \
+ /* _drop will become _last). */ \
+ X = _ldrop = _last; \
+ _drop = NULL; \
+ for (_count = 0;; _count++) { \
+ /* Terminate if this is the last node in the gap */ \
+ if (X->forward[_i] == _next) { \
+ if (!_drop) \
+ _drop = X; \
+ break; \
+ } \
\
- /* If we have already found the node to drop into and there */ \
- /* is more than one node in this gap, we can stop searching */ \
- if (_drop) { \
- HDassert(_count >= 1); \
- _count = 2; \
- break; \
+ /* If we have already found the node to drop into and there */ \
+ /* is more than one node in this gap, we can stop searching */ \
+ if (_drop) { \
+ HDassert(_count >= 1); \
+ _count = 2; \
+ break; \
+ } \
+ else { /* !_drop */ \
+ /* Check if this node is the start of the next gap */ \
+ if (!H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) { \
+ _drop = X; \
+ /* Again check if we can stop searching */ \
+ if (_count) { \
+ _count = 2; \
+ break; \
+ } \
} \
- else { /* !_drop */ \
- /* Check if this node is the start of the next gap */ \
- if (!H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, X->forward[_i], KEY, HASHVAL)) { \
- _drop = X; \
- /* Again check if we can stop searching */ \
- if (_count) { \
- _count = 2; \
- break; \
- } /* end if */ \
- } /* end if */ \
- else \
- _ldrop = X; \
- } /* end else */ \
+ else \
+ _ldrop = X; \
+ } \
\
- /* No need to check the last node in the gap if there are */ \
- /* 3, as there cannot be a fourth */ \
- if (_count == 2) { \
- if (!_drop) \
- _drop = X->forward[_i]; \
- break; \
- } /* end if */ \
- X = X->forward[_i]; \
- } /* end for */ \
- HDassert(_count >= 1 && _count <= 3); \
- HDassert(!_drop->forward[_i] || \
- !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \
+ /* No need to check the last node in the gap if there are */ \
+ /* 3, as there cannot be a fourth */ \
+ if (_count == 2) { \
+ if (!_drop) \
+ _drop = X->forward[_i]; \
+ break; \
+ } \
+ X = X->forward[_i]; \
+ } \
+ HDassert(_count >= 1 && _count <= 3); \
+ HDassert(!_drop->forward[_i] || \
+ !H5_GLUE3(H5SL_LOCATE_, CMP, _CMP)(SLIST, TYPE, _drop->forward[_i], KEY, HASHVAL)); \
\
- /* Check if we need to adjust node heights */ \
- if (_count == 1) { \
- /* Check if we are in the first gap */ \
- if (_llast == _last) { \
- /* We are in the first gap, count the number of nodes */ \
- /* of height _i in the next gap. We need only check */ \
- /* onenode to see if we should promote the first node */ \
- /* in the next gap */ \
- _llast = _next->forward[_i + 1]; \
+ /* Check if we need to adjust node heights */ \
+ if (_count == 1) { \
+ /* Check if we are in the first gap */ \
+ if (_llast == _last) { \
+ /* We are in the first gap, count the number of nodes */ \
+ /* of height _i in the next gap. We need only check */ \
+ /* onenode to see if we should promote the first node */ \
+ /* in the next gap */ \
+ _llast = _next->forward[_i + 1]; \
\
- /* Demote the separator node */ \
- H5SL_DEMOTE(_next, _last) \
+ /* Demote the separator node */ \
+ H5SL_DEMOTE(_next, _last) \
\
- /* If there are 2 or more nodes, promote the first */ \
- if (_next->forward[_i]->forward[_i] != _llast) { \
- X = _next->forward[_i]; \
- H5SL_PROMOTE(SLIST, X, _last, NULL) \
- } \
- else if (!_head->forward[_i + 1]) { \
- /* shrink the header */ \
- HDassert(_i == SLIST->curr_level - 1); \
- HDassert((size_t)SLIST->curr_level == _head->level); \
+ /* If there are 2 or more nodes, promote the first */ \
+ if (_next->forward[_i]->forward[_i] != _llast) { \
+ X = _next->forward[_i]; \
+ H5SL_PROMOTE(SLIST, X, _last, NULL) \
+ } \
+ else if (!_head->forward[_i + 1]) { \
+ /* shrink the header */ \
+ HDassert(_i == SLIST->curr_level - 1); \
+ HDassert((size_t)SLIST->curr_level == _head->level); \
\
- H5SL_SHRINK(_head, (size_t)(_i + 1)) \
- SLIST->curr_level--; \
- } /* end else */ \
+ H5SL_SHRINK(_head, (size_t)(_i + 1)) \
+ SLIST->curr_level--; \
} \
- else { \
- /* We are not in the first gap, count the number of */ \
- /* nodes of height _i in the previous gap. Note we */ \
- /* "look ahead" in this loop so X has the value of the */ \
- /* last node in the previous gap. */ \
- X = _llast->forward[_i]; \
- for (_count = 1; _count < 3 && X->forward[_i] != _last; _count++) \
- X = X->forward[_i]; \
- HDassert(X->forward[_i] == _last); \
+ } \
+ else { \
+ /* We are not in the first gap, count the number of */ \
+ /* nodes of height _i in the previous gap. Note we */ \
+ /* "look ahead" in this loop so X has the value of the */ \
+ /* last node in the previous gap. */ \
+ X = _llast->forward[_i]; \
+ for (_count = 1; _count < 3 && X->forward[_i] != _last; _count++) \
+ X = X->forward[_i]; \
+ HDassert(X->forward[_i] == _last); \
\
- /* Demote the separator node */ \
- H5SL_DEMOTE(_last, _llast) \
+ /* Demote the separator node */ \
+ H5SL_DEMOTE(_last, _llast) \
\
- /* If there are 2 or more nodes, promote the last */ \
- if (_count >= 2) \
- H5SL_PROMOTE(SLIST, X, _llast, NULL) \
- else if (!_head->forward[_i + 1]) { \
- /* shrink the header */ \
- HDassert(_i == SLIST->curr_level - 1); \
- HDassert((size_t)SLIST->curr_level == _head->level); \
+ /* If there are 2 or more nodes, promote the last */ \
+ if (_count >= 2) \
+ H5SL_PROMOTE(SLIST, X, _llast, NULL) \
+ else if (!_head->forward[_i + 1]) { \
+ /* shrink the header */ \
+ HDassert(_i == SLIST->curr_level - 1); \
+ HDassert((size_t)SLIST->curr_level == _head->level); \
\
- H5SL_SHRINK(_head, (size_t)(_i + 1)) \
- SLIST->curr_level--; \
- } /* end else */ \
- } /* end else */ \
- } /* end if */ \
+ H5SL_SHRINK(_head, (size_t)(_i + 1)) \
+ SLIST->curr_level--; \
+ } \
+ } \
+ } \
\
- /* Prepare to drop down */ \
- _llast = _ldrop; \
- _last = _drop; \
- _next = _drop->forward[_i]; \
- } /* end for */ \
+ /* Prepare to drop down */ \
+ _llast = _ldrop; \
+ _last = _drop; \
+ _next = _drop->forward[_i]; \
+ } \
\
- /* Check if we've found the node */ \
- if (_next && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, _next, KEY, HASHVAL)) { \
- void *tmp = _next->item; \
- X = _next; \
+ /* Check if we've found the node */ \
+ if (_next && H5_GLUE3(H5SL_LOCATE_, CMP, _EQ)(SLIST, TYPE, _next, KEY, HASHVAL)) { \
+ void *tmp = _next->item; \
+ X = _next; \
\
- /* If the node has a height > 0, swap it with its (lower) */ \
- /* neighbor */ \
- if (X->level) { \
- X = X->backward; \
- _next->key = X->key; \
- _next->item = X->item; \
- _next->hashval = X->hashval; \
- } /* end if */ \
- HDassert(!X->level); \
+ /* If the node has a height > 0, swap it with its (lower) */ \
+ /* neighbor */ \
+ if (X->level) { \
+ X = X->backward; \
+ _next->key = X->key; \
+ _next->item = X->item; \
+ _next->hashval = X->hashval; \
+ } \
+ HDassert(!X->level); \
\
- /* Remove the node */ \
- X->backward->forward[0] = X->forward[0]; \
- if (SLIST->last == X) \
- SLIST->last = X->backward; \
- else \
- X->forward[0]->backward = X->backward; \
- SLIST->nobjs--; \
- X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[0], X->forward); \
- X = H5FL_FREE(H5SL_node_t, X); \
+ /* Remove the node */ \
+ X->backward->forward[0] = X->forward[0]; \
+ if (SLIST->last == X) \
+ SLIST->last = X->backward; \
+ else \
+ X->forward[0]->backward = X->backward; \
+ SLIST->nobjs--; \
+ X->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[0], X->forward); \
+ X = H5FL_FREE(H5SL_node_t, X); \
\
- HGOTO_DONE(tmp); \
- } /* end if */ \
- } /* end else */ \
+ HGOTO_DONE(tmp); \
+ } \
}
/* Macro used to search for node */
@@ -542,7 +487,6 @@ struct H5SL_node_t {
size_t level; /* The level of this node */
size_t log_nalloc; /* log2(Number of slots allocated in forward) */
uint32_t hashval; /* Hash value for key (only for strings, currently) */
- hbool_t removed; /* Whether the node is "removed" (actual removal deferred) */
struct H5SL_node_t **forward; /* Array of forward pointers from this node */
struct H5SL_node_t * backward; /* Backward pointer from this node */
};
@@ -558,8 +502,6 @@ struct H5SL_t {
size_t nobjs; /* Number of active objects in skip list */
H5SL_node_t *header; /* Header for nodes in skip list */
H5SL_node_t *last; /* Pointer to last node in skip list */
- hbool_t safe_iterating; /* Whether a routine is "safely" iterating over the list and removals should be
- deferred */
};
/* Static functions */
@@ -651,11 +593,11 @@ H5SL_term_package(void)
for (i = 0; i < H5SL_fac_nused_g; i++) {
ret = H5FL_fac_term(H5SL_fac_g[i]);
HDassert(ret >= 0);
- } /* end if */
+ }
H5SL_fac_nused_g = 0;
n++;
- } /* end if */
+ }
/* Free the list of factories */
if (H5SL_fac_g) {
@@ -663,12 +605,12 @@ H5SL_term_package(void)
H5SL_fac_nalloc_g = 0;
n++;
- } /* end if */
+ }
/* Mark the interface as uninitialized */
if (0 == n)
H5_PKG_INIT_VAR = FALSE;
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(n)
} /* H5SL_term_package() */
@@ -711,11 +653,10 @@ H5SL__new_node(void *item, const void *key, uint32_t hashval)
ret_value->item = item;
ret_value->level = 0;
ret_value->hashval = hashval;
- ret_value->removed = FALSE;
if (NULL == (ret_value->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0]))) {
ret_value = H5FL_FREE(H5SL_node_t, ret_value);
HGOTO_ERROR(H5E_SLIST, H5E_NOSPACE, NULL, "memory allocation failed")
- } /* end if */
+ }
ret_value->log_nalloc = 0;
done:
@@ -805,7 +746,7 @@ H5SL__insert_common(H5SL_t *slist, void *item, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* 'key' must not have been found in existing list, if we get here */
@@ -880,15 +821,22 @@ H5SL__release_common(H5SL_t *slist, H5SL_operator_t op, void *op_data)
while (node) {
next_node = node->forward[0];
- /* Call callback, if one is given */
+ /* Call callback, if one is given.
+ *
+ * Ignoring const here is fine as we only need the value to be const
+ * with respect to the list code, which should never modify the
+ * elements. The library code that is making use of the skip list
+ * container can do what it likes with the elements.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
if (op)
- /* Casting away const OK -QAK */
(void)(op)(node->item, (void *)node->key, op_data);
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
node->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward);
node = H5FL_FREE(H5SL_node_t, node);
node = next_node;
- } /* end while */
+ }
/* Reset the header pointers */
slist->header->forward =
@@ -1001,9 +949,8 @@ H5SL_create(H5SL_type_t type, H5SL_cmp_t cmp)
new_slist->cmp = cmp;
/* Set the dynamic internal fields */
- new_slist->curr_level = -1;
- new_slist->nobjs = 0;
- new_slist->safe_iterating = FALSE;
+ new_slist->curr_level = -1;
+ new_slist->nobjs = 0;
/* Allocate the header node */
if (NULL == (header = H5SL__new_node(NULL, NULL, (uint32_t)ULONG_MAX)))
@@ -1027,7 +974,7 @@ done:
if (ret_value == NULL) {
if (new_slist != NULL)
new_slist = H5FL_FREE(H5SL_t, new_slist);
- } /* end if */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SL_create() */
@@ -1058,9 +1005,6 @@ H5SL_count(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1099,9 +1043,6 @@ H5SL_insert(H5SL_t *slist, void *item, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1148,9 +1089,6 @@ H5SL_add(H5SL_t *slist, void *item, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1242,7 +1180,7 @@ H5SL_remove(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1281,9 +1219,6 @@ H5SL_remove_first(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Assign level */
H5_CHECK_OVERFLOW(slist->curr_level, int, size_t);
level = (size_t)slist->curr_level;
@@ -1345,12 +1280,12 @@ H5SL_remove_first(H5SL_t *slist)
H5SL_SHRINK(head, level)
slist->curr_level--;
- } /* end else */
+ }
}
else
break;
- } /* end for */
- } /* end if */
+ }
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1436,7 +1371,7 @@ H5SL_search(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* 'key' must not have been found in list, if we get here */
ret_value = NULL;
@@ -1480,9 +1415,6 @@ H5SL_less(H5SL_t *slist, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1531,7 +1463,7 @@ H5SL_less(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* Check for a node with a key that is less than the given 'key' */
@@ -1541,13 +1473,13 @@ H5SL_less(H5SL_t *slist, const void *key)
ret_value = slist->last->item;
else
ret_value = NULL;
- } /* end if */
+ }
else {
if (x->backward != slist->header)
ret_value = x->backward->item;
else
ret_value = NULL;
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1588,9 +1520,6 @@ H5SL_greater(H5SL_t *slist, const void *key)
HDassert(slist);
HDassert(key);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -1639,7 +1568,7 @@ H5SL_greater(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* ('x' must be the next node with a key greater than the 'key', or NULL) */
@@ -1734,7 +1663,7 @@ H5SL_find(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* 'key' must not have been found in list, if we get here */
ret_value = NULL;
@@ -1826,7 +1755,7 @@ H5SL_below(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* Check for a node with a key that is less than the given 'key' */
@@ -1836,13 +1765,13 @@ H5SL_below(H5SL_t *slist, const void *key)
ret_value = slist->last;
else
ret_value = NULL;
- } /* end if */
+ }
else {
if (x->backward != slist->header)
ret_value = x->backward;
else
ret_value = NULL;
- } /* end else */
+ }
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1931,7 +1860,7 @@ H5SL_above(H5SL_t *slist, const void *key)
default:
HDassert(0 && "Unknown skiplist type!");
- } /* end switch */
+ }
/* An exact match for 'key' must not have been found in list, if we get here */
/* ('x' must be the next node with a key greater than the 'key', or NULL) */
@@ -1971,9 +1900,6 @@ H5SL_first(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2007,9 +1933,6 @@ H5SL_next(H5SL_node_t *slist_node)
/* Check args */
HDassert(slist_node);
- /* Not currently supported */
- HDassert(!slist_node->removed);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2043,9 +1966,6 @@ H5SL_prev(H5SL_node_t *slist_node)
/* Check args */
HDassert(slist_node);
- /* Not currently supported */
- HDassert(!slist_node->removed);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2080,9 +2000,6 @@ H5SL_last(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2116,9 +2033,6 @@ H5SL_item(H5SL_node_t *slist_node)
/* Check args */
HDassert(slist_node);
- /* Not currently supported */
- HDassert(!slist_node->removed);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2179,15 +2093,21 @@ H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data)
/* Protect against the node being deleted by the callback */
next = node->forward[0];
- /* Call the iterator callback */
- /* Casting away const OK -QAK */
- if (!node->removed)
- if ((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0)
- break;
+ /* Call the iterator callback
+ *
+ * Ignoring const here is fine as we only need the value to be const
+ * with respect to the list code, which should never modify the
+ * elements. The library code that is making use of the skip list
+ * container can do what it likes with the elements.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ if ((ret_value = (op)(node->item, (void *)node->key, op_data)) != 0)
+ break;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
/* Advance to next node */
node = next;
- } /* end while */
+ }
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5SL_iterate() */
@@ -2222,9 +2142,6 @@ H5SL_release(H5SL_t *slist)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2274,9 +2191,6 @@ H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data)
/* Check args */
HDassert(slist);
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
/* Check internal consistency */
/* (Pre-condition) */
@@ -2290,186 +2204,6 @@ done:
/*--------------------------------------------------------------------------
NAME
- H5SL_try_free_safe
- PURPOSE
- Makes the supplied callback on all nodes in the skip list, freeing each
- node that the callback returns TRUE for.
- USAGE
- herr_t PURPOSE(slist,op,opdata)
- H5SL_t *slist; IN/OUT: Pointer to skip list to release nodes
- H5SL_try_free_op_t op; IN: Callback function to try to free item & key
- void *op_data; IN/OUT: Pointer to application data for callback
-
- RETURNS
- Returns non-negative on success, negative on failure.
- DESCRIPTION
- Makes the supplied callback on all nodes in the skip list, freeing each
- node that the callback returns TRUE for. The iteration is performed in
- a safe manner, such that the callback can call H5SL_remove(),
- H5SL_search(), H5SL_find(), and H5SL_iterate() on nodes in this
- skiplist, except H5SL_remove() may not be call on *this* node.
- GLOBAL VARIABLES
- COMMENTS, BUGS, ASSUMPTIONS
- This function is written to be most efficient when most nodes are
- removed from the skiplist, as it rebuilds the nodes afterwards.
- EXAMPLES
- REVISION LOG
---------------------------------------------------------------------------*/
-herr_t
-H5SL_try_free_safe(H5SL_t *slist, H5SL_try_free_op_t op, void *op_data)
-{
- H5SL_node_t *node, *next_node, *last_node; /* Pointers to skip list nodes */
- htri_t op_ret;
- herr_t ret_value = SUCCEED;
-
- FUNC_ENTER_NOAPI_NOINIT
-
- /* Check args */
- HDassert(slist);
- HDassert(op);
-
- /* Not currently supported */
- HDassert(!slist->safe_iterating);
-
- /* Check internal consistency */
- /* (Pre-condition) */
-
- /* Mark skip list as safe iterating, so nodes aren't freed out from under
- * us */
- slist->safe_iterating = TRUE;
-
- /* Iterate over skip list nodes, making the callback for each and marking
- * them as removed if requested by the callback */
- node = slist->header->forward[0];
- while (node) {
- /* Check if the node was already removed */
- if (!node->removed) {
- /* Call callback */
- /* Casting away const OK -NAF */
- if ((op_ret = (op)(node->item, (void *)node->key, op_data)) < 0)
- HGOTO_ERROR(H5E_SLIST, H5E_CALLBACK, FAIL, "callback operation failed")
-
- /* Check if op indicated that the node should be removed */
- if (op_ret)
- /* Mark the node as removed */
- node->removed = TRUE;
- } /* end if */
-
- /* Advance node */
- node = node->forward[0];
- } /* end while */
-
- /* Reset safe_iterating */
- slist->safe_iterating = FALSE;
-
- /* Iterate over nodes, freeing ones marked as removed */
- node = slist->header->forward[0];
- last_node = slist->header;
- while (node) {
- /* Save next node */
- next_node = node->forward[0];
-
- /* Check if the node was marked as removed */
- if (node->removed) {
- /* Remove the node */
- node->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], node->forward);
- node = H5FL_FREE(H5SL_node_t, node);
- slist->nobjs--;
- } /* end if */
- else {
- /* Update backwards and forwards[0] pointers, and set the level to
- * 0. Since the list is flattened we must rebuild the skiplist
- * afterwards. */
- /* Set level to 0. Note there is no need to preserve
- * node->forward[0] since it was cached above and will always be
- * updated later. */
- if (node->level > 0) {
- node->forward =
- (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[node->log_nalloc], (void *)node->forward);
- if (NULL == (node->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0])))
- HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
- node->log_nalloc = 0;
- node->level = 0;
- } /* end if */
-
- /* Update pointers */
- last_node->forward[0] = node;
- node->backward = last_node;
- last_node = node;
- } /* end else */
-
- /* Advance node */
- node = next_node;
- } /* end while */
-
- /* Final pointer update */
- last_node->forward[0] = NULL;
- slist->last = last_node;
-
- /* Demote skip list to level 0 */
- if (slist->curr_level > 0) {
- HDassert(slist->header->level == (size_t)slist->curr_level);
-
- node = slist->header->forward[0];
- slist->header->forward = (H5SL_node_t **)H5FL_FAC_FREE(H5SL_fac_g[slist->header->log_nalloc],
- (void *)slist->header->forward);
- if (NULL == (slist->header->forward = (H5SL_node_t **)H5FL_FAC_MALLOC(H5SL_fac_g[0])))
- HGOTO_ERROR(H5E_SLIST, H5E_CANTALLOC, FAIL, "memory allocation failed")
- slist->header->forward[0] = node;
- slist->header->log_nalloc = 0;
- slist->header->level = 0;
- } /* end if */
-
- /* Check if there are any nodes left */
- if (slist->nobjs > 0) {
- int i;
-
- HDassert(slist->header->forward[0]);
-
- /* Set skiplist level to 0 */
- slist->curr_level = 0;
-
- /* Rebuild the forward arrays */
- for (i = 0; slist->curr_level >= i; i++) {
- HDassert(slist->curr_level == i);
-
- /* Promote every third node this level until we run out of nodes */
- node = last_node = slist->header;
- while (1) {
- /* Check second node in gap, if not present, no need to promote
- * further this level. */
- HDassert(node->forward[i]);
- node = node->forward[i]->forward[i];
- if (!node)
- break;
-
- /* Check third and fourth node in gap, if either is not present,
- * no need to promote further this level. */
- node = node->forward[i];
- if (!node || !node->forward[i])
- break;
-
- /* Promote the third node in the gap */
- H5SL_PROMOTE(slist, node, last_node, FAIL)
- last_node = node;
- } /* end while */
- } /* end for */
- } /* end if */
- else {
- HDassert(!slist->header->forward[0]);
- HDassert(slist->last == slist->header);
- HDassert(slist->nobjs == 0);
-
- /* Reset the skiplist level */
- slist->curr_level = -1;
- } /* end else */
-
-done:
- FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5SL_try_free_safe() */
-
-/*--------------------------------------------------------------------------
- NAME
H5SL_destroy
PURPOSE
Close a skip list, deallocating it and freeing all its nodes.
diff --git a/src/H5SLprivate.h b/src/H5SLprivate.h
index c9e1147..be6f7b6 100644
--- a/src/H5SLprivate.h
+++ b/src/H5SLprivate.h
@@ -60,9 +60,6 @@ typedef int (*H5SL_cmp_t)(const void *key1, const void *key2);
/* Typedef for iteration operations */
typedef herr_t (*H5SL_operator_t)(void *item, void *key, void *operator_data /*in,out*/);
-/* Typedef for H5SL_try_free_safe operation callback */
-typedef htri_t (*H5SL_try_free_op_t)(void *item, void *key, void *operator_data /*in,out*/);
-
/********************/
/* Private routines */
/********************/
@@ -86,7 +83,6 @@ H5_DLL void * H5SL_item(H5SL_node_t *slist_node);
H5_DLL herr_t H5SL_iterate(H5SL_t *slist, H5SL_operator_t op, void *op_data);
H5_DLL herr_t H5SL_release(H5SL_t *slist);
H5_DLL herr_t H5SL_free(H5SL_t *slist, H5SL_operator_t op, void *op_data);
-H5_DLL herr_t H5SL_try_free_safe(H5SL_t *slist, H5SL_try_free_op_t op, void *op_data);
H5_DLL herr_t H5SL_close(H5SL_t *slist);
H5_DLL herr_t H5SL_destroy(H5SL_t *slist, H5SL_operator_t op, void *op_data);
H5_DLL int H5SL_term_interface(void);
diff --git a/src/H5SM.c b/src/H5SM.c
index e8ce4b2..03fb08c 100644
--- a/src/H5SM.c
+++ b/src/H5SM.c
@@ -1079,7 +1079,7 @@ H5SM_try_share(H5F_t *f, H5O_t *open_oh, unsigned defer_flags, unsigned type_id,
ssize_t index_num;
htri_t tri_ret;
#ifndef NDEBUG
- unsigned deferred_type = -1u;
+ unsigned deferred_type = -1U;
#endif
htri_t ret_value = TRUE;
diff --git a/src/H5Smodule.h b/src/H5Smodule.h
index bb33eb8..010f4a6 100644
--- a/src/H5Smodule.h
+++ b/src/H5Smodule.h
@@ -30,29 +30,36 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5S H5S
- * \brief Dataspace Interface
*
- * \details The Dataspace Interface provides functions for creating and
- * working with dataspaces.
+ * Use the functions in this module to manage HDF5 dataspaces \Emph{and} selections.
*
- * A dataspace has two roles:
+ * HDF5 dataspaces describe the \Emph{shape} of datasets in memory or in HDF5
+ * files. Dataspaces can be empty (#H5S_NULL), a singleton (#H5S_SCALAR), or
+ * a multi-dimensional, regular grid (#H5S_SIMPLE). Dataspaces can be re-shaped.
*
- * \li It contains the spatial information (logical layout) of a
- * dataset stored in a file.
- * \li It describes an application’s data buffers and data elements
- * participating in I/O. In other words, it can be used to
- * select a portion or subset of a dataset.
+ * Subsets of dataspaces can be "book-marked" or used to restrict I/O operations
+ * using \Emph{selections}. Furthermore, certain set operations are supported
+ * for selections.
*
- * The spatial information of a dataset in a file includes the
- * rank and dimensions of the dataset, which are a permanent part
- * of the dataset definition. It can have dimensions that are fixed
- * (unchanging) or unlimited, which means they can grow in size
- * (or are extendible).
- *
- * A dataspace can consist of:
- * \li no elements (NULL)
- * \li a single element (scalar), or
- * \li a simple array.
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5S_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5S_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5S_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5S_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
*/
diff --git a/src/H5Spublic.h b/src/H5Spublic.h
index 7962035..30ca813 100644
--- a/src/H5Spublic.h
+++ b/src/H5Spublic.h
@@ -26,98 +26,101 @@
#define H5S_BLOCK 1 /* (hid_t) */
#define H5S_PLIST 2 /* (hid_t) */
-/* Define value for 'unlimited' dimensions */
-#define H5S_UNLIMITED HSIZE_UNDEF
+#define H5S_UNLIMITED HSIZE_UNDEF /**< Value for 'unlimited' dimensions */
-/* Define user-level maximum number of dimensions */
+/**
+ * The maximum dataspace rank or number of dimensions
+ */
#define H5S_MAX_RANK 32
/* Flags for selection iterators */
#define H5S_SEL_ITER_GET_SEQ_LIST_SORTED \
- 0x0001 /* Retrieve elements from iterator \
- * in increasing offset order, for \
- * each call to retrieve sequences. \
- * Currently, this only applies to \
- * point selections, as hyperslab \
- * selections are always returned \
- * in increasing offset order. \
- * \
- * Note that the order is only \
- * increasing for each call to \
- * get_seq_list, the next set of \
- * sequences could start with an \
- * earlier offset than the previous \
- * one. \
+ 0x0001 /**< Retrieve elements from iterator in increasing offset order, for \
+ * each call to retrieve sequences. Currently, this only applies to \
+ * point selections, as hyperslab selections are always returned in \
+ * increasing offset order. Note that the order is only increasing \
+ * for each call to H5Sget_seq_list(), the next set of sequences \
+ * could start with an earlier offset than the previous one. \
*/
#define H5S_SEL_ITER_SHARE_WITH_DATASPACE \
- 0x0002 /* Don't copy the dataspace \
- * selection when creating the \
- * selection iterator. \
- * \
- * This can improve performance \
- * of creating the iterator, but \
- * the dataspace _MUST_NOT_ be \
- * modified or closed until the \
- * selection iterator is closed \
- * or the iterator's behavior \
- * will be undefined. \
+ 0x0002 /**< Don't copy the dataspace selection when creating the selection \
+ * iterator. This can improve performance of creating the iterator, \
+ * but the dataspace \Bold{MUST NOT} be modified or closed until the \
+ * selection iterator is closed or the iterator's behavior will be \
+ * undefined. \
*/
-/* Different types of dataspaces */
+/**
+ * Types of dataspaces
+ */
typedef enum H5S_class_t {
- H5S_NO_CLASS = -1, /*error */
- H5S_SCALAR = 0, /*scalar variable */
- H5S_SIMPLE = 1, /*simple dataspace */
- H5S_NULL = 2 /*null dataspace */
+ H5S_NO_CLASS = -1, /**< Error */
+ H5S_SCALAR = 0, /**< Singleton (scalar) */
+ H5S_SIMPLE = 1, /**< Regular grid */
+ H5S_NULL = 2 /**< Empty set */
} H5S_class_t;
-/* Different ways of combining selections */
+/**
+ * Different ways of combining selections
+ */
typedef enum H5S_seloper_t {
- H5S_SELECT_NOOP = -1, /* error */
- H5S_SELECT_SET = 0, /* Select "set" operation */
- H5S_SELECT_OR, /* Binary "or" operation for hyperslabs
+ H5S_SELECT_NOOP = -1, /**< Error */
+ H5S_SELECT_SET = 0, /**< Select "set" operation */
+ H5S_SELECT_OR, /**< Binary "or" operation for hyperslabs
* (add new selection to existing selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A or B: CCCCCCCCCCCCCCCC
+ * \endcode
*/
- H5S_SELECT_AND, /* Binary "and" operation for hyperslabs
+ H5S_SELECT_AND, /**< Binary "and" operation for hyperslabs
* (only leave overlapped regions in selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A and B: CCCC
+ * \endcode
*/
- H5S_SELECT_XOR, /* Binary "xor" operation for hyperslabs
+ H5S_SELECT_XOR, /**< Binary "xor" operation for hyperslabs
* (only leave non-overlapped regions in selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A xor B: CCCCCC CCCCCC
+ * \endcode
*/
- H5S_SELECT_NOTB, /* Binary "not" operation for hyperslabs
+ H5S_SELECT_NOTB, /**< Binary "not" operation for hyperslabs
* (only leave non-overlapped regions in original selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* A not B: CCCCCC
+ * \endcode
*/
- H5S_SELECT_NOTA, /* Binary "not" operation for hyperslabs
+ H5S_SELECT_NOTA, /**< Binary "not" operation for hyperslabs
* (only leave non-overlapped regions in new selection)
+ * \code
* Original region: AAAAAAAAAA
* New region: BBBBBBBBBB
* B not A: CCCCCC
+ * \endcode
*/
- H5S_SELECT_APPEND, /* Append elements to end of point selection */
- H5S_SELECT_PREPEND, /* Prepend elements to beginning of point selection */
- H5S_SELECT_INVALID /* Invalid upper bound on selection operations */
+ H5S_SELECT_APPEND, /**< Append elements to end of point selection */
+ H5S_SELECT_PREPEND, /**< Prepend elements to beginning of point selection */
+ H5S_SELECT_INVALID /**< Invalid upper bound on selection operations */
} H5S_seloper_t;
-/* Enumerated type for the type of selection */
+/**
+ * Selection type
+ */
typedef enum {
- H5S_SEL_ERROR = -1, /* Error */
- H5S_SEL_NONE = 0, /* Nothing selected */
- H5S_SEL_POINTS = 1, /* Points / elements selected */
- H5S_SEL_HYPERSLABS = 2, /* Hyperslab selected */
- H5S_SEL_ALL = 3, /* Entire extent selected */
- H5S_SEL_N /*THIS MUST BE LAST */
+ H5S_SEL_ERROR = -1, /**< Error */
+ H5S_SEL_NONE = 0, /**< Empty selection */
+ H5S_SEL_POINTS = 1, /**< Set of points */
+ H5S_SEL_HYPERSLABS = 2, /**< Hyperslab */
+ H5S_SEL_ALL = 3, /**< Everything */
+ H5S_SEL_N /**< Sentinel \internal THIS MUST BE LAST */
} H5S_sel_type;
#ifdef __cplusplus
@@ -1318,9 +1321,6 @@ H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
* \details H5Sset_extent_simple() sets or resets the size of an existing
* dataspace.
*
- * \p rank is the dimensionality, or number of dimensions, of the
- * dataspace.
- *
* \p dims is an array of size \p rank which contains the new size
* of each dimension in the dataspace. \p max is an array of size
* \p rank which contains the maximum size of each dimension in
@@ -1329,10 +1329,6 @@ H5_DLL herr_t H5Sset_extent_none(hid_t space_id);
* Any previous extent is removed from the dataspace, the dataspace
* type is set to #H5S_SIMPLE, and the extent is set as specified.
*
- * Note that a dataset must be chunked if \p dims does not equal
- * \p max.
- *
- *
* \version 1.4.0 Fortran subroutine was introduced.
* \since 1.0.0
*
diff --git a/src/H5T.c b/src/H5T.c
index b6bfb9a..461e6b9 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -290,7 +290,7 @@
#define H5T_INIT_TYPE_SET_SIZE(SIZE) \
{ \
dt->shared->size = SIZE; \
- dt->shared->u.atomic.prec = 8 * SIZE; \
+ dt->shared->u.atomic.prec = 8 * (SIZE); \
}
#define H5T_INIT_TYPE_NOSET_SIZE(SIZE) \
@@ -327,7 +327,7 @@
H5_GLUE3(H5T_INIT_TYPE_, GUTS, _CORE) \
\
/* Register result */ \
- if ((GLOBAL = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \
+ if (((GLOBAL) = H5I_register(H5I_DATATYPE, dt, FALSE)) < 0) \
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREGISTER, FAIL, "unable to register datatype atom") \
}
@@ -423,31 +423,29 @@ hid_t H5T_C_S1_g = FAIL;
hid_t H5T_FORTRAN_S1_g = FAIL;
-hid_t H5T_NATIVE_SCHAR_g = FAIL;
-hid_t H5T_NATIVE_UCHAR_g = FAIL;
-hid_t H5T_NATIVE_SHORT_g = FAIL;
-hid_t H5T_NATIVE_USHORT_g = FAIL;
-hid_t H5T_NATIVE_INT_g = FAIL;
-hid_t H5T_NATIVE_UINT_g = FAIL;
-hid_t H5T_NATIVE_LONG_g = FAIL;
-hid_t H5T_NATIVE_ULONG_g = FAIL;
-hid_t H5T_NATIVE_LLONG_g = FAIL;
-hid_t H5T_NATIVE_ULLONG_g = FAIL;
-hid_t H5T_NATIVE_FLOAT_g = FAIL;
-hid_t H5T_NATIVE_DOUBLE_g = FAIL;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+hid_t H5T_NATIVE_SCHAR_g = FAIL;
+hid_t H5T_NATIVE_UCHAR_g = FAIL;
+hid_t H5T_NATIVE_SHORT_g = FAIL;
+hid_t H5T_NATIVE_USHORT_g = FAIL;
+hid_t H5T_NATIVE_INT_g = FAIL;
+hid_t H5T_NATIVE_UINT_g = FAIL;
+hid_t H5T_NATIVE_LONG_g = FAIL;
+hid_t H5T_NATIVE_ULONG_g = FAIL;
+hid_t H5T_NATIVE_LLONG_g = FAIL;
+hid_t H5T_NATIVE_ULLONG_g = FAIL;
+hid_t H5T_NATIVE_FLOAT_g = FAIL;
+hid_t H5T_NATIVE_DOUBLE_g = FAIL;
hid_t H5T_NATIVE_LDOUBLE_g = FAIL;
-#endif
-hid_t H5T_NATIVE_B8_g = FAIL;
-hid_t H5T_NATIVE_B16_g = FAIL;
-hid_t H5T_NATIVE_B32_g = FAIL;
-hid_t H5T_NATIVE_B64_g = FAIL;
-hid_t H5T_NATIVE_OPAQUE_g = FAIL;
-hid_t H5T_NATIVE_HADDR_g = FAIL;
-hid_t H5T_NATIVE_HSIZE_g = FAIL;
-hid_t H5T_NATIVE_HSSIZE_g = FAIL;
-hid_t H5T_NATIVE_HERR_g = FAIL;
-hid_t H5T_NATIVE_HBOOL_g = FAIL;
+hid_t H5T_NATIVE_B8_g = FAIL;
+hid_t H5T_NATIVE_B16_g = FAIL;
+hid_t H5T_NATIVE_B32_g = FAIL;
+hid_t H5T_NATIVE_B64_g = FAIL;
+hid_t H5T_NATIVE_OPAQUE_g = FAIL;
+hid_t H5T_NATIVE_HADDR_g = FAIL;
+hid_t H5T_NATIVE_HSIZE_g = FAIL;
+hid_t H5T_NATIVE_HSSIZE_g = FAIL;
+hid_t H5T_NATIVE_HERR_g = FAIL;
+hid_t H5T_NATIVE_HBOOL_g = FAIL;
hid_t H5T_NATIVE_INT8_g = FAIL;
hid_t H5T_NATIVE_UINT8_g = FAIL;
@@ -483,21 +481,19 @@ hid_t H5T_NATIVE_UINT_FAST64_g = FAIL;
* datatype or C structures, which are different from the alignments for memory
* address below this group of variables.
*/
-size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_UCHAR_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_SHORT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_USHORT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_LONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_ULONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_LLONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_ULLONG_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g = 0;
-size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 0;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+size_t H5T_NATIVE_SCHAR_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_UCHAR_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_SHORT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_USHORT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_LONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_ULONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_LLONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_ULLONG_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g = 0;
+size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g = 0;
size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g = 0;
-#endif
size_t H5T_POINTER_COMP_ALIGN_g = 0;
size_t H5T_HVL_COMP_ALIGN_g = 0;
@@ -509,21 +505,19 @@ size_t H5T_REF_COMP_ALIGN_g = 0;
* Alignment constraints for native types. These are initialized at run time
* in H5Tinit.c
*/
-size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
-size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
-size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
-size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
-size_t H5T_NATIVE_INT_ALIGN_g = 0;
-size_t H5T_NATIVE_UINT_ALIGN_g = 0;
-size_t H5T_NATIVE_LONG_ALIGN_g = 0;
-size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
-size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
-size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
-size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
-size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+size_t H5T_NATIVE_SCHAR_ALIGN_g = 0;
+size_t H5T_NATIVE_UCHAR_ALIGN_g = 0;
+size_t H5T_NATIVE_SHORT_ALIGN_g = 0;
+size_t H5T_NATIVE_USHORT_ALIGN_g = 0;
+size_t H5T_NATIVE_INT_ALIGN_g = 0;
+size_t H5T_NATIVE_UINT_ALIGN_g = 0;
+size_t H5T_NATIVE_LONG_ALIGN_g = 0;
+size_t H5T_NATIVE_ULONG_ALIGN_g = 0;
+size_t H5T_NATIVE_LLONG_ALIGN_g = 0;
+size_t H5T_NATIVE_ULLONG_ALIGN_g = 0;
+size_t H5T_NATIVE_FLOAT_ALIGN_g = 0;
+size_t H5T_NATIVE_DOUBLE_ALIGN_g = 0;
size_t H5T_NATIVE_LDOUBLE_ALIGN_g = 0;
-#endif
/*
* Alignment constraints for C9x types. These are initialized at run time in
@@ -560,8 +554,8 @@ size_t H5T_NATIVE_UINT_FAST64_ALIGN_g = 0;
/* Useful floating-point values for conversion routines */
/* (+/- Inf for all floating-point types) */
-float H5T_NATIVE_FLOAT_POS_INF_g = 0.0f;
-float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0f;
+float H5T_NATIVE_FLOAT_POS_INF_g = 0.0F;
+float H5T_NATIVE_FLOAT_NEG_INF_g = 0.0F;
double H5T_NATIVE_DOUBLE_POS_INF_g = 0.0;
double H5T_NATIVE_DOUBLE_NEG_INF_g = 0.0;
@@ -760,42 +754,40 @@ DESCRIPTION
herr_t
H5T__init_package(void)
{
- H5T_t *native_schar = NULL; /* Datatype structure for native signed char */
- H5T_t *native_uchar = NULL; /* Datatype structure for native unsigned char */
- H5T_t *native_short = NULL; /* Datatype structure for native short */
- H5T_t *native_ushort = NULL; /* Datatype structure for native unsigned short */
- H5T_t *native_int = NULL; /* Datatype structure for native int */
- H5T_t *native_uint = NULL; /* Datatype structure for native unsigned int */
- H5T_t *native_long = NULL; /* Datatype structure for native long */
- H5T_t *native_ulong = NULL; /* Datatype structure for native unsigned long */
- H5T_t *native_llong = NULL; /* Datatype structure for native long long */
- H5T_t *native_ullong = NULL; /* Datatype structure for native unsigned long long */
- H5T_t *native_float = NULL; /* Datatype structure for native float */
- H5T_t *native_double = NULL; /* Datatype structure for native double */
-#if H5_SIZEOF_LONG_DOUBLE != 0
- H5T_t *native_ldouble = NULL; /* Datatype structure for native long double */
-#endif
- H5T_t * std_u8le = NULL; /* Datatype structure for unsigned 8-bit little-endian integer */
- H5T_t * std_u8be = NULL; /* Datatype structure for unsigned 8-bit big-endian integer */
- H5T_t * std_u16le = NULL; /* Datatype structure for unsigned 16-bit little-endian integer */
- H5T_t * std_u16be = NULL; /* Datatype structure for unsigned 16-bit big-endian integer */
- H5T_t * std_u32le = NULL; /* Datatype structure for unsigned 32-bit little-endian integer */
- H5T_t * std_u32be = NULL; /* Datatype structure for unsigned 32-bit big-endian integer */
- H5T_t * std_u64le = NULL; /* Datatype structure for unsigned 64-bit little-endian integer */
- H5T_t * std_u64be = NULL; /* Datatype structure for unsigned 64-bit big-endian integer */
- H5T_t * dt = NULL;
- H5T_t * fixedpt = NULL; /* Datatype structure for native int */
- H5T_t * floatpt = NULL; /* Datatype structure for native float */
- H5T_t * string = NULL; /* Datatype structure for C string */
- H5T_t * bitfield = NULL; /* Datatype structure for bitfield */
- H5T_t * compound = NULL; /* Datatype structure for compound objects */
- H5T_t * enum_type = NULL; /* Datatype structure for enum objects */
- H5T_t * vlen = NULL; /* Datatype structure for vlen objects */
- H5T_t * array = NULL; /* Datatype structure for array objects */
- H5T_t * objref = NULL; /* Datatype structure for deprecated reference objects */
- H5T_t * regref = NULL; /* Datatype structure for deprecated region references */
- H5T_t * ref = NULL; /* Datatype structure for opaque references */
- hsize_t dim[1] = {1}; /* Dimension info for array datatype */
+ H5T_t * native_schar = NULL; /* Datatype structure for native signed char */
+ H5T_t * native_uchar = NULL; /* Datatype structure for native unsigned char */
+ H5T_t * native_short = NULL; /* Datatype structure for native short */
+ H5T_t * native_ushort = NULL; /* Datatype structure for native unsigned short */
+ H5T_t * native_int = NULL; /* Datatype structure for native int */
+ H5T_t * native_uint = NULL; /* Datatype structure for native unsigned int */
+ H5T_t * native_long = NULL; /* Datatype structure for native long */
+ H5T_t * native_ulong = NULL; /* Datatype structure for native unsigned long */
+ H5T_t * native_llong = NULL; /* Datatype structure for native long long */
+ H5T_t * native_ullong = NULL; /* Datatype structure for native unsigned long long */
+ H5T_t * native_float = NULL; /* Datatype structure for native float */
+ H5T_t * native_double = NULL; /* Datatype structure for native double */
+ H5T_t * native_ldouble = NULL; /* Datatype structure for native long double */
+ H5T_t * std_u8le = NULL; /* Datatype structure for unsigned 8-bit little-endian integer */
+ H5T_t * std_u8be = NULL; /* Datatype structure for unsigned 8-bit big-endian integer */
+ H5T_t * std_u16le = NULL; /* Datatype structure for unsigned 16-bit little-endian integer */
+ H5T_t * std_u16be = NULL; /* Datatype structure for unsigned 16-bit big-endian integer */
+ H5T_t * std_u32le = NULL; /* Datatype structure for unsigned 32-bit little-endian integer */
+ H5T_t * std_u32be = NULL; /* Datatype structure for unsigned 32-bit big-endian integer */
+ H5T_t * std_u64le = NULL; /* Datatype structure for unsigned 64-bit little-endian integer */
+ H5T_t * std_u64be = NULL; /* Datatype structure for unsigned 64-bit big-endian integer */
+ H5T_t * dt = NULL;
+ H5T_t * fixedpt = NULL; /* Datatype structure for native int */
+ H5T_t * floatpt = NULL; /* Datatype structure for native float */
+ H5T_t * string = NULL; /* Datatype structure for C string */
+ H5T_t * bitfield = NULL; /* Datatype structure for bitfield */
+ H5T_t * compound = NULL; /* Datatype structure for compound objects */
+ H5T_t * enum_type = NULL; /* Datatype structure for enum objects */
+ H5T_t * vlen = NULL; /* Datatype structure for vlen objects */
+ H5T_t * array = NULL; /* Datatype structure for array objects */
+ H5T_t * objref = NULL; /* Datatype structure for deprecated reference objects */
+ H5T_t * regref = NULL; /* Datatype structure for deprecated region references */
+ H5T_t * ref = NULL; /* Datatype structure for opaque references */
+ hsize_t dim[1] = {1}; /* Dimension info for array datatype */
herr_t status;
hbool_t copied_dtype =
TRUE; /* Flag to indicate whether datatype was copied or allocated (for error cleanup) */
@@ -843,10 +835,8 @@ H5T__init_package(void)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
if (NULL == (native_double = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
-#if H5_SIZEOF_LONG_DOUBLE != 0
if (NULL == (native_ldouble = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE_g)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype object")
-#endif
/*------------------------------------------------------------
* Derived native types
@@ -1116,7 +1106,6 @@ H5T__init_package(void)
H5T__register_int(H5T_PERS_HARD, "flt_dbl", native_float, native_double, H5T__conv_float_double);
status |=
H5T__register_int(H5T_PERS_HARD, "dbl_flt", native_double, native_float, H5T__conv_double_float);
-#if H5_SIZEOF_LONG_DOUBLE != 0
status |=
H5T__register_int(H5T_PERS_HARD, "flt_ldbl", native_float, native_ldouble, H5T__conv_float_ldouble);
status |=
@@ -1125,7 +1114,6 @@ H5T__init_package(void)
H5T__register_int(H5T_PERS_HARD, "ldbl_flt", native_ldouble, native_float, H5T__conv_ldouble_float);
status |=
H5T__register_int(H5T_PERS_HARD, "ldbl_dbl", native_ldouble, native_double, H5T__conv_ldouble_double);
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/* from long long */
status |=
@@ -1663,31 +1651,29 @@ H5T_top_term_package(void)
H5T_FORTRAN_S1_g = FAIL;
- H5T_NATIVE_SCHAR_g = FAIL;
- H5T_NATIVE_UCHAR_g = FAIL;
- H5T_NATIVE_SHORT_g = FAIL;
- H5T_NATIVE_USHORT_g = FAIL;
- H5T_NATIVE_INT_g = FAIL;
- H5T_NATIVE_UINT_g = FAIL;
- H5T_NATIVE_LONG_g = FAIL;
- H5T_NATIVE_ULONG_g = FAIL;
- H5T_NATIVE_LLONG_g = FAIL;
- H5T_NATIVE_ULLONG_g = FAIL;
- H5T_NATIVE_FLOAT_g = FAIL;
- H5T_NATIVE_DOUBLE_g = FAIL;
-#if H5_SIZEOF_LONG_DOUBLE != 0
+ H5T_NATIVE_SCHAR_g = FAIL;
+ H5T_NATIVE_UCHAR_g = FAIL;
+ H5T_NATIVE_SHORT_g = FAIL;
+ H5T_NATIVE_USHORT_g = FAIL;
+ H5T_NATIVE_INT_g = FAIL;
+ H5T_NATIVE_UINT_g = FAIL;
+ H5T_NATIVE_LONG_g = FAIL;
+ H5T_NATIVE_ULONG_g = FAIL;
+ H5T_NATIVE_LLONG_g = FAIL;
+ H5T_NATIVE_ULLONG_g = FAIL;
+ H5T_NATIVE_FLOAT_g = FAIL;
+ H5T_NATIVE_DOUBLE_g = FAIL;
H5T_NATIVE_LDOUBLE_g = FAIL;
-#endif
- H5T_NATIVE_B8_g = FAIL;
- H5T_NATIVE_B16_g = FAIL;
- H5T_NATIVE_B32_g = FAIL;
- H5T_NATIVE_B64_g = FAIL;
- H5T_NATIVE_OPAQUE_g = FAIL;
- H5T_NATIVE_HADDR_g = FAIL;
- H5T_NATIVE_HSIZE_g = FAIL;
- H5T_NATIVE_HSSIZE_g = FAIL;
- H5T_NATIVE_HERR_g = FAIL;
- H5T_NATIVE_HBOOL_g = FAIL;
+ H5T_NATIVE_B8_g = FAIL;
+ H5T_NATIVE_B16_g = FAIL;
+ H5T_NATIVE_B32_g = FAIL;
+ H5T_NATIVE_B64_g = FAIL;
+ H5T_NATIVE_OPAQUE_g = FAIL;
+ H5T_NATIVE_HADDR_g = FAIL;
+ H5T_NATIVE_HSIZE_g = FAIL;
+ H5T_NATIVE_HSSIZE_g = FAIL;
+ H5T_NATIVE_HERR_g = FAIL;
+ H5T_NATIVE_HBOOL_g = FAIL;
H5T_NATIVE_INT8_g = FAIL;
H5T_NATIVE_UINT8_g = FAIL;
@@ -1892,19 +1878,24 @@ H5Tcopy(hid_t obj_id)
break;
case H5I_DATASET: {
- H5VL_object_t *vol_obj = NULL; /* Dataset structure */
+ H5VL_object_t * vol_obj; /* Object for obj_id */
+ H5VL_dataset_get_args_t vol_cb_args; /* Arguments to VOL callback */
/* The argument is a dataset handle */
if (NULL == (vol_obj = (H5VL_object_t *)H5I_object_verify(obj_id, H5I_DATASET)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "type_id is not a dataset ID")
+ /* 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 from the dataset
* NOTE: This will have to be closed after we're done with it.
*/
- if (H5VL_dataset_get(vol_obj, H5VL_DATASET_GET_TYPE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &dset_tid) < 0)
+ if (H5VL_dataset_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID,
"unable to get datatype from the dataset")
+ dset_tid = vol_cb_args.args.get_type.type_id;
/* Unwrap the type ID */
if (NULL == (dt = (H5T_t *)H5I_object(dset_tid)))
diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c
index 91801c6..d079e71 100644
--- a/src/H5Tcommit.c
+++ b/src/H5Tcommit.c
@@ -790,12 +790,19 @@ H5Tget_create_plist(hid_t dtype_id)
} /* end if */
/* If the datatype is committed, retrieve further information */
else {
- H5VL_object_t *vol_obj = type->vol_obj;
+ H5VL_object_t * vol_obj = type->vol_obj;
+ H5VL_datatype_get_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_GET_TCPL;
+ vol_cb_args.args.get_tcpl.tcpl_id = H5I_INVALID_HID;
/* Get the property list through the VOL */
- if (H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_TCPL, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &ret_value) < 0)
+ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, H5I_INVALID_HID, "can't get object creation info")
+
+ /* Set return value */
+ ret_value = vol_cb_args.args.get_tcpl.tcpl_id;
} /* end else */
done:
@@ -829,15 +836,21 @@ H5Tflush(hid_t type_id)
if (!H5T_is_named(dt))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype")
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
-
/* Flush metadata for named datatype */
- if (dt->vol_obj)
- if (H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_FLUSH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, type_id) < 0)
+ if (dt->vol_obj) {
+ H5VL_datatype_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(type_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_FLUSH;
+ vol_cb_args.args.flush.type_id = type_id;
+
+ if (H5VL_datatype_specific(dt->vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -870,15 +883,21 @@ H5Trefresh(hid_t type_id)
if (!H5T_is_named(dt))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a committed datatype")
- /* Set up collective metadata if appropriate */
- if (H5CX_set_loc(type_id) < 0)
- HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
-
/* Refresh the datatype's metadata */
- if (dt->vol_obj)
- if (H5VL_datatype_specific(dt->vol_obj, H5VL_DATATYPE_REFRESH, H5P_DATASET_XFER_DEFAULT,
- H5_REQUEST_NULL, type_id) < 0)
+ if (dt->vol_obj) {
+ H5VL_datatype_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up collective metadata if appropriate */
+ if (H5CX_set_loc(type_id) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "can't set access property list info")
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_REFRESH;
+ vol_cb_args.args.refresh.type_id = type_id;
+
+ if (H5VL_datatype_specific(dt->vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
+ }
done:
FUNC_LEAVE_API(ret_value)
@@ -1222,32 +1241,41 @@ H5T_update_shared(H5T_t *dt)
H5T_t *
H5T_construct_datatype(H5VL_object_t *vol_obj)
{
- ssize_t nalloc;
- void * buf = NULL;
- H5T_t * dt = NULL; /* datatype object from VOL connector */
- H5T_t * ret_value = NULL;
+ H5T_t * dt = NULL; /* Datatype object from VOL connector */
+ H5VL_datatype_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t nalloc = 0; /* Size required to store serialized form of datatype */
+ void * buf = NULL; /* Buffer to store serialized datatype */
+ H5T_t * ret_value = NULL;
FUNC_ENTER_NOAPI(NULL)
- /* get required buf size for encoding the datatype */
- if (H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &nalloc, NULL, 0) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_GET_BINARY_SIZE;
+ vol_cb_args.args.get_binary_size.size = &nalloc;
+
+ /* Get required buf size for encoding the datatype */
+ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get datatype serialized size")
- /* allocate buffer to store binary description of the datatype */
- if (NULL == (buf = (void *)H5MM_calloc((size_t)nalloc)))
+ /* Allocate buffer to store binary description of the datatype */
+ if (NULL == (buf = (void *)H5MM_calloc(nalloc)))
HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "can't allocate space for datatype")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_DATATYPE_GET_BINARY;
+ vol_cb_args.args.get_binary.buf = buf;
+ vol_cb_args.args.get_binary.buf_size = nalloc;
+
/* get binary description of the datatype */
- if (H5VL_datatype_get(vol_obj, H5VL_DATATYPE_GET_BINARY, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &nalloc, buf, (size_t)nalloc) < 0)
+ if (H5VL_datatype_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "unable to get serialized datatype")
- if (NULL == (dt = H5T_decode((size_t)nalloc, (const unsigned char *)buf)))
+ /* Construct datatype, from serialized form in buffer */
+ if (NULL == (dt = H5T_decode(nalloc, buf)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, NULL, "can't decode datatype")
-
dt->vol_obj = vol_obj;
+ /* Set return value */
ret_value = dt;
done:
@@ -1407,3 +1435,34 @@ H5T_already_vol_managed(const H5T_t *dt)
FUNC_LEAVE_NOAPI(dt->vol_obj != NULL)
} /* end H5T_already_vol_managed() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5T_invoke_vol_optional
+ *
+ * Purpose: Invokes an optional VOL connector-specific operation on a named datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5T_invoke_vol_optional(H5T_t *dt, H5VL_optional_args_t *args, hid_t dxpl_id, void **req,
+ H5VL_object_t **vol_obj_ptr)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Check that datatype is committed */
+ if (!H5T_is_named(dt))
+ HGOTO_ERROR(H5E_DATATYPE, H5E_BADTYPE, FAIL, "not a committed datatype")
+
+ /* Only invoke callback if VOL object is set for the datatype */
+ if (dt->vol_obj)
+ if (H5VL_datatype_optional_op(dt->vol_obj, args, dxpl_id, req, vol_obj_ptr) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5T_invoke_vol_optional() */
diff --git a/src/H5Tconv.c b/src/H5Tconv.c
index 0c98633..c06c895 100644
--- a/src/H5Tconv.c
+++ b/src/H5Tconv.c
@@ -7009,14 +7009,12 @@ H5T__conv_float_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_float_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_fF(FLOAT, LDOUBLE, float, long double, -, -);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_double_float
@@ -7051,14 +7049,12 @@ H5T__conv_double_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t ne
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_fF(DOUBLE, LDOUBLE, double, long double, -, -);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_ldouble_float
@@ -7073,14 +7069,12 @@ H5T__conv_double_ldouble(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_Ff(LDOUBLE, FLOAT, long double, float, -FLT_MAX, FLT_MAX);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_ldouble_double
@@ -7095,14 +7089,12 @@ H5T__conv_ldouble_float(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t n
*
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
herr_t
H5T__conv_ldouble_double(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
H5T_CONV_Ff(LDOUBLE, DOUBLE, long double, double, -DBL_MAX, DBL_MAX);
}
-#endif /* H5_SIZEOF_LONG_DOUBLE != 0 */
/*-------------------------------------------------------------------------
* Function: H5T__conv_schar_float
@@ -7725,9 +7717,9 @@ herr_t
H5T__conv_float_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, SCHAR, float, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7747,9 +7739,9 @@ herr_t
H5T__conv_float_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, UCHAR, float, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7769,9 +7761,9 @@ herr_t
H5T__conv_double_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, SCHAR, double, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7791,9 +7783,9 @@ herr_t
H5T__conv_double_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, UCHAR, double, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7813,9 +7805,9 @@ herr_t
H5T__conv_ldouble_schar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, SCHAR, long double, signed char, SCHAR_MIN, SCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7835,9 +7827,9 @@ herr_t
H5T__conv_ldouble_uchar(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, UCHAR, long double, unsigned char, 0, UCHAR_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7857,9 +7849,9 @@ herr_t
H5T__conv_float_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, SHORT, float, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7879,9 +7871,9 @@ herr_t
H5T__conv_float_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, USHORT, float, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7901,9 +7893,9 @@ herr_t
H5T__conv_double_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, SHORT, double, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7923,9 +7915,9 @@ herr_t
H5T__conv_double_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, USHORT, double, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7945,9 +7937,9 @@ herr_t
H5T__conv_ldouble_short(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, SHORT, long double, short, SHRT_MIN, SHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7967,9 +7959,9 @@ herr_t
H5T__conv_ldouble_ushort(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, USHORT, long double, unsigned short, 0, USHRT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -7989,9 +7981,9 @@ herr_t
H5T__conv_float_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, INT, float, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8011,9 +8003,9 @@ herr_t
H5T__conv_float_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, UINT, float, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8033,9 +8025,9 @@ herr_t
H5T__conv_double_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, INT, double, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8055,9 +8047,9 @@ herr_t
H5T__conv_double_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, UINT, double, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8077,9 +8069,9 @@ herr_t
H5T__conv_ldouble_int(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, INT, long double, int, INT_MIN, INT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8099,9 +8091,9 @@ herr_t
H5T__conv_ldouble_uint(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, UINT, long double, unsigned int, 0, UINT_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8121,9 +8113,9 @@ herr_t
H5T__conv_float_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, LONG, float, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8143,9 +8135,9 @@ herr_t
H5T__conv_float_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, ULONG, float, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8165,9 +8157,9 @@ herr_t
H5T__conv_double_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, LONG, double, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8187,9 +8179,9 @@ herr_t
H5T__conv_double_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, ULONG, double, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8209,9 +8201,9 @@ herr_t
H5T__conv_ldouble_long(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, LONG, long double, long, LONG_MIN, LONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8231,9 +8223,9 @@ herr_t
H5T__conv_ldouble_ulong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, ULONG, long double, unsigned long, 0, ULONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8253,9 +8245,9 @@ herr_t
H5T__conv_float_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, LLONG, float, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8275,9 +8267,9 @@ herr_t
H5T__conv_float_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(FLOAT, ULLONG, float, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8297,9 +8289,9 @@ herr_t
H5T__conv_double_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, LLONG, double, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8319,9 +8311,9 @@ herr_t
H5T__conv_double_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(DOUBLE, ULLONG, double, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
/*-------------------------------------------------------------------------
@@ -8342,9 +8334,9 @@ herr_t
H5T__conv_ldouble_llong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, LLONG, long double, long long, LLONG_MIN, LLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_LLONG*/
@@ -8366,9 +8358,9 @@ herr_t
H5T__conv_ldouble_ullong(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, size_t buf_stride,
size_t H5_ATTR_UNUSED bkg_stride, void *buf, void H5_ATTR_UNUSED *bkg)
{
- H5_GCC_DIAG_OFF("float-equal")
+ H5_GCC_CLANG_DIAG_OFF("float-equal")
H5T_CONV_Fx(LDOUBLE, ULLONG, long double, unsigned long long, 0, ULLONG_MAX);
- H5_GCC_DIAG_ON("float-equal")
+ H5_GCC_CLANG_DIAG_ON("float-equal")
}
#endif /*H5T_CONV_INTERNAL_LDOUBLE_ULLONG*/
diff --git a/src/H5Tmodule.h b/src/H5Tmodule.h
index c489edc..73424fb 100644
--- a/src/H5Tmodule.h
+++ b/src/H5Tmodule.h
@@ -29,10 +29,38 @@
#define H5_MY_PKG_ERR H5E_DATATYPE
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5T H5T
- * \brief Datatype Interface
- * \todo Describe concisely what the functions in this module are about.
+/**\defgroup H5T H5T
+ *
+ * Use the functions in this module to manage HDF5 datatypes.
+ *
+ * HDF5 datatypes describe the element type of HDF5 datasets and attributes.
+ * There's a large set of predefined datatypes, but users may find it useful
+ * to define new datatypes through a process called \Emph{derivation}.
+ *
+ * The element type is automatically persisted as part of the HDF5 metadata of
+ * attributes and datasets. Additionally, datatype definitions can be persisted
+ * to HDF5 files and linked to groups as HDF5 datatype objects or so-called
+ * \Emph{committed datatypes}.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5T_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5T_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5T_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5T_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
*
* \defgroup ARRAY Array Datatypes
* \ingroup H5T
diff --git a/src/H5Tnative.c b/src/H5Tnative.c
index 2688b23..c9a2907 100644
--- a/src/H5Tnative.c
+++ b/src/H5Tnative.c
@@ -718,9 +718,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
enum match_type { /* The different kinds of floating point types we can match */
H5T_NATIVE_FLOAT_MATCH_FLOAT,
H5T_NATIVE_FLOAT_MATCH_DOUBLE,
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5T_NATIVE_FLOAT_MATCH_LDOUBLE,
-#endif
H5T_NATIVE_FLOAT_MATCH_UNKNOWN
} match = H5T_NATIVE_FLOAT_MATCH_UNKNOWN;
H5T_t *ret_value = NULL; /* Return value */
@@ -738,24 +736,16 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
match = H5T_NATIVE_FLOAT_MATCH_DOUBLE;
native_size = sizeof(double);
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (size <= sizeof(long double)) {
match = H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
native_size = sizeof(long double);
}
-#endif
else { /* If not match, return the biggest datatype */
-#if H5_SIZEOF_LONG_DOUBLE != 0
match = H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
native_size = sizeof(long double);
-#else
- match = H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
-#endif
}
}
else {
-#if H5_SIZEOF_LONG_DOUBLE != 0
if (size > sizeof(double)) {
match = H5T_NATIVE_FLOAT_MATCH_LDOUBLE;
native_size = sizeof(long double);
@@ -768,16 +758,6 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
match = H5T_NATIVE_FLOAT_MATCH_FLOAT;
native_size = sizeof(float);
}
-#else
- if (size > sizeof(float)) {
- match = H5T_NATIVE_FLOAT_MATCH_DOUBLE;
- native_size = sizeof(double);
- }
- else {
- match = H5T_NATIVE_FLOAT_MATCH_FLOAT;
- native_size = sizeof(float);
- }
-#endif
}
/* Set the appropriate native floating point information */
@@ -792,12 +772,11 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali
align = H5T_NATIVE_DOUBLE_COMP_ALIGN_g;
break;
-#if H5_SIZEOF_LONG_DOUBLE != 0
case H5T_NATIVE_FLOAT_MATCH_LDOUBLE:
tid = H5T_NATIVE_LDOUBLE;
align = H5T_NATIVE_LDOUBLE_COMP_ALIGN_g;
break;
-#endif
+
case H5T_NATIVE_FLOAT_MATCH_UNKNOWN:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "Unknown native floating-point match")
diff --git a/src/H5Tpkg.h b/src/H5Tpkg.h
index 51ecaca..19593dd 100644
--- a/src/H5Tpkg.h
+++ b/src/H5Tpkg.h
@@ -401,9 +401,7 @@ H5_DLLVAR size_t H5T_NATIVE_LONG_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_LLONG_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_FLOAT_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_COMP_ALIGN_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_COMP_ALIGN_g;
-#endif
H5_DLLVAR size_t H5T_POINTER_COMP_ALIGN_g;
H5_DLLVAR size_t H5T_HVL_COMP_ALIGN_g;
@@ -429,9 +427,7 @@ H5_DLLVAR size_t H5T_NATIVE_LLONG_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_ULLONG_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_FLOAT_ALIGN_g;
H5_DLLVAR size_t H5T_NATIVE_DOUBLE_ALIGN_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR size_t H5T_NATIVE_LDOUBLE_ALIGN_g;
-#endif
/* C9x alignment constraints */
H5_DLLVAR size_t H5T_NATIVE_INT8_ALIGN_g;
@@ -468,10 +464,8 @@ H5_DLLVAR float H5T_NATIVE_FLOAT_POS_INF_g;
H5_DLLVAR float H5T_NATIVE_FLOAT_NEG_INF_g;
H5_DLLVAR double H5T_NATIVE_DOUBLE_POS_INF_g;
H5_DLLVAR double H5T_NATIVE_DOUBLE_NEG_INF_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR double H5T_NATIVE_LDOUBLE_POS_INF_g;
H5_DLLVAR double H5T_NATIVE_LDOUBLE_NEG_INF_g;
-#endif
/* Declare extern the free lists for H5T_t's and H5T_shared_t's */
H5FL_EXTERN(H5T_t);
diff --git a/src/H5Tprivate.h b/src/H5Tprivate.h
index 2a45e17..6624096 100644
--- a/src/H5Tprivate.h
+++ b/src/H5Tprivate.h
@@ -59,10 +59,7 @@ typedef struct H5T_path_t H5T_path_t;
struct H5S_t;
/* How to copy a datatype */
-typedef enum H5T_copy_t {
- H5T_COPY_TRANSIENT,
- H5T_COPY_ALL,
-} H5T_copy_t;
+typedef enum H5T_copy_t { H5T_COPY_TRANSIENT, H5T_COPY_ALL } H5T_copy_t;
/* Location of datatype information */
typedef enum {
@@ -155,6 +152,8 @@ H5_DLL herr_t H5T_save_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O
H5_DLL herr_t H5T_restore_refresh_state(hid_t tid, struct H5O_shared_t *cached_H5O_shared);
H5_DLL hbool_t H5T_already_vol_managed(const H5T_t *dt);
H5_DLL htri_t H5T_is_vl_storage(const H5T_t *dt);
+H5_DLL herr_t H5T_invoke_vol_optional(H5T_t *dt, H5VL_optional_args_t *args, hid_t dxpl_id, void **req,
+ H5VL_object_t **vol_obj_ptr);
/* Reference specific functions */
H5_DLL H5R_type_t H5T_get_ref_type(const H5T_t *dt);
diff --git a/src/H5Tpublic.h b/src/H5Tpublic.h
index bb5b0ef..911efdf 100644
--- a/src/H5Tpublic.h
+++ b/src/H5Tpublic.h
@@ -803,13 +803,11 @@ H5_DLLVAR hid_t H5T_VAX_F64_g;
* C-style \Code{double}
*/
#define H5T_NATIVE_DOUBLE (H5OPEN H5T_NATIVE_DOUBLE_g)
-#if H5_SIZEOF_LONG_DOUBLE != 0
/**
* \ingroup PDTNAT
* C-style \Code{long double}
*/
#define H5T_NATIVE_LDOUBLE (H5OPEN H5T_NATIVE_LDOUBLE_g)
-#endif
/**
* \ingroup PDTNAT
* HDF5 8-bit bitfield based on native types
@@ -872,9 +870,7 @@ H5_DLLVAR hid_t H5T_NATIVE_LLONG_g;
H5_DLLVAR hid_t H5T_NATIVE_ULLONG_g;
H5_DLLVAR hid_t H5T_NATIVE_FLOAT_g;
H5_DLLVAR hid_t H5T_NATIVE_DOUBLE_g;
-#if H5_SIZEOF_LONG_DOUBLE != 0
H5_DLLVAR hid_t H5T_NATIVE_LDOUBLE_g;
-#endif
H5_DLLVAR hid_t H5T_NATIVE_B8_g;
H5_DLLVAR hid_t H5T_NATIVE_B16_g;
H5_DLLVAR hid_t H5T_NATIVE_B32_g;
diff --git a/src/H5Tref.c b/src/H5Tref.c
index 1114c25..511c531 100644
--- a/src/H5Tref.c
+++ b/src/H5Tref.c
@@ -289,12 +289,16 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
} /* end else-if */
else {
H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
size_t ref_encode_size;
H5R_ref_priv_t fixed_ref;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
/* Retrieve min encode size (when references have no vlen part) */
@@ -305,8 +309,8 @@ H5T__ref_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, FAIL, "can't get encode size")
/* Size on disk, memory size is different */
- dt->shared->size = MAX(H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE + cont_info.blob_id_size,
- ref_encode_size);
+ dt->shared->size =
+ MAX(sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE + cont_info.blob_id_size, ref_encode_size);
dt->shared->u.atomic.prec = 8 * dt->shared->size;
/* Set up the function pointers to access the information on
@@ -434,8 +438,10 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf
/* Force re-calculating encoding size if any flags are set */
if (flags || !src_ref->encode_size) {
- char file_name_buf_static[256]; /* File name */
- ssize_t file_name_len; /* Size of file name buffer */
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ char * file_name = NULL; /* Actual file name */
+ char file_name_buf_static[256]; /* File name */
+ size_t file_name_len = 0; /* Length of file name */
/* Pass the correct encoding version for the selection depending on the
* file libver bounds, this is later retrieved in H5S hyper encode */
@@ -458,21 +464,38 @@ H5T__ref_mem_getsize(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf
H5CX_set_libver_bounds(NULL);
} /* end if */
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = H5I_FILE;
+ vol_cb_args.args.get_name.buf_size = sizeof(file_name_buf_static);
+ vol_cb_args.args.get_name.buf = file_name_buf_static;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
/* Get file name */
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
- if (file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
- if (NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+
+ /* Check if we need to allocate a buffer for the file name */
+ if (file_name_len >= sizeof(file_name_buf_static)) {
+ /* Allocate file name buffer */
+ if (NULL == (file_name_buf_dyn = H5MM_malloc(file_name_len + 1)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+
+ /* Update VOL callback arguments */
+ vol_cb_args.args.get_name.buf_size = file_name_len + 1;
+ vol_cb_args.args.get_name.buf = file_name_buf_dyn;
+
+ /* Get file name again */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+
+ file_name = file_name_buf_dyn;
} /* end if */
+ else
+ file_name = file_name_buf_static;
/* Determine encoding size */
- if (H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref, NULL,
- &ret_value, flags) < 0)
+ if (H5R__encode(file_name, src_ref, NULL, &ret_value, flags) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, 0, "unable to determine encoding size")
} /* end if */
else {
@@ -506,10 +529,10 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
H5VL_object_t * vol_obj; /* VOL object for src ref's location */
const H5R_ref_priv_t *src_ref = (const H5R_ref_priv_t *)src_buf;
hbool_t files_equal = TRUE; /* Whether src & dst references are in same file */
+ char * file_name = NULL; /* Actual file name */
char file_name_buf_static[256] = {'\0'}; /* File name */
char * file_name_buf_dyn =
NULL; /* Pointer to dynamically allocated buffer for file name, if static buffer is too small */
- ssize_t file_name_len; /* Size of file name buffer */
unsigned flags = 0; /* References flags */
herr_t ret_value = SUCCEED; /* Return value */
@@ -560,21 +583,42 @@ H5T__ref_mem_read(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf, s
/* Get file name (if external reference) */
if (flags) {
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- sizeof(file_name_buf_static), file_name_buf_static, &file_name_len) < 0)
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t file_name_len = 0; /* Length of file name */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_NAME;
+ vol_cb_args.args.get_name.type = H5I_FILE;
+ vol_cb_args.args.get_name.buf_size = sizeof(file_name_buf_static);
+ vol_cb_args.args.get_name.buf = file_name_buf_static;
+ vol_cb_args.args.get_name.file_name_len = &file_name_len;
+
+ /* Get file name */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
- if (file_name_len >= (ssize_t)sizeof(file_name_buf_static)) {
- if (NULL == (file_name_buf_dyn = (char *)H5MM_malloc((size_t)file_name_len + 1)))
- HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
- if (H5VL_file_get(vol_obj, H5VL_FILE_GET_NAME, H5P_DATASET_XFER_DEFAULT, NULL, H5I_FILE,
- (size_t)file_name_len + 1, file_name_buf_dyn, &file_name_len) < 0)
+
+ /* Check if we need to allocate a buffer for the file name */
+ if (file_name_len >= sizeof(file_name_buf_static)) {
+ /* Allocate file name buffer */
+ if (NULL == (file_name_buf_dyn = H5MM_malloc(file_name_len + 1)))
+ HGOTO_ERROR(H5E_REFERENCE, H5E_CANTALLOC, 0, "can't allocate space for file name")
+
+ /* Update VOL callback arguments */
+ vol_cb_args.args.get_name.buf_size = file_name_len + 1;
+ vol_cb_args.args.get_name.buf = file_name_buf_dyn;
+
+ /* Get file name again */
+ if (H5VL_file_get(vol_obj, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTGET, 0, "can't get file name")
+
+ file_name = file_name_buf_dyn;
} /* end if */
- } /* end if */
+ else
+ file_name = file_name_buf_static;
+ } /* end if */
/* Encode reference */
- if (H5R__encode(file_name_buf_dyn ? file_name_buf_dyn : file_name_buf_static, src_ref,
- (unsigned char *)dst_buf, &dst_size, flags) < 0)
+ if (H5R__encode(file_name, src_ref, (unsigned char *)dst_buf, &dst_size, flags) < 0)
HGOTO_ERROR(H5E_REFERENCE, H5E_CANTENCODE, FAIL, "Cannot encode reference")
done:
@@ -731,11 +775,17 @@ H5T__ref_disk_isnull(const H5VL_object_t *src_file, const void *src_buf, hbool_t
*isnull = FALSE;
}
else {
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
/* Skip the size / header */
- p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T;
+ p = (const uint8_t *)src_buf + H5R_ENCODE_HEADER_SIZE + sizeof(uint32_t);
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_ISNULL;
+ vol_cb_args.args.is_null.isnull = isnull;
/* Check if blob ID is "nil" */
- if (H5VL_blob_specific(src_file, (void *)p, H5VL_BLOB_ISNULL, isnull) < 0)
+ if (H5VL_blob_specific(src_file, (void *)p, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
}
@@ -755,9 +805,10 @@ done:
static herr_t
H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
{
- uint8_t *q = (uint8_t *)dst_buf;
- uint8_t *p_bg = (uint8_t *)bg_buf;
- herr_t ret_value = SUCCEED;
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ uint8_t * q = (uint8_t *)dst_buf;
+ uint8_t * p_bg = (uint8_t *)bg_buf;
+ herr_t ret_value = SUCCEED;
FUNC_ENTER_STATIC
H5T_REF_LOG_DEBUG("");
@@ -768,10 +819,13 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
/* TODO Should get rid of bg stuff */
if (p_bg) {
/* Skip the size / header */
- p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ p_bg += (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE);
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_DELETE;
/* Remove blob for old data */
- if (H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
} /* end if */
@@ -782,8 +836,11 @@ H5T__ref_disk_setnull(H5VL_object_t *dst_file, void *dst_buf, void *bg_buf)
/* Set the size */
UINT32ENCODE(q, 0);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_SETNULL;
+
/* Set blob ID to "nil" */
- if (H5VL_blob_specific(dst_file, q, H5VL_BLOB_SETNULL) < 0)
+ if (H5VL_blob_specific(dst_file, q, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
done:
@@ -872,8 +929,8 @@ H5T__ref_disk_read(H5VL_object_t *src_file, const void *src_buf, size_t H5_ATTR_
blob_size -= H5R_ENCODE_HEADER_SIZE;
/* Skip the size */
- p += H5_SIZEOF_UINT32_T;
- HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + H5_SIZEOF_UINT32_T));
+ p += sizeof(uint32_t);
+ HDassert(src_size > (H5R_ENCODE_HEADER_SIZE + sizeof(uint32_t)));
/* Retrieve blob */
if (H5VL_blob_get(src_file, p, q, blob_size, NULL) < 0)
@@ -913,15 +970,19 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
/* TODO Should get rid of bg stuff */
if (p_bg) {
- size_t p_buf_size_left = dst_size;
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ size_t p_buf_size_left = dst_size;
/* Skip the size / header */
- p_bg += (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
- HDassert(p_buf_size_left > (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE));
- p_buf_size_left -= (H5_SIZEOF_UINT32_T + H5R_ENCODE_HEADER_SIZE);
+ p_bg += (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE);
+ HDassert(p_buf_size_left > (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE));
+ p_buf_size_left -= (sizeof(uint32_t) + H5R_ENCODE_HEADER_SIZE);
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_DELETE;
/* Remove blob for old data */
- if (H5VL_blob_specific(dst_file, (void *)p_bg, H5VL_BLOB_DELETE) < 0)
+ if (H5VL_blob_specific(dst_file, (void *)p_bg, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
} /* end if */
@@ -930,12 +991,12 @@ H5T__ref_disk_write(H5VL_object_t H5_ATTR_UNUSED *src_file, const void *src_buf,
p += H5R_ENCODE_HEADER_SIZE;
q += H5R_ENCODE_HEADER_SIZE;
src_size -= H5R_ENCODE_HEADER_SIZE;
- buf_size_left -= H5_SIZEOF_UINT32_T;
+ buf_size_left -= sizeof(uint32_t);
/* Set the size */
UINT32ENCODE(q, src_size);
- HDassert(buf_size_left > H5_SIZEOF_UINT32_T);
- buf_size_left -= H5_SIZEOF_UINT32_T;
+ HDassert(buf_size_left > sizeof(uint32_t));
+ buf_size_left -= sizeof(uint32_t);
/* Store blob */
if (H5VL_blob_put(dst_file, p, src_size, q, NULL) < 0)
diff --git a/src/H5Tvlen.c b/src/H5Tvlen.c
index 39d14f3..080d725 100644
--- a/src/H5Tvlen.c
+++ b/src/H5Tvlen.c
@@ -247,8 +247,7 @@ done:
htri_t
H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
{
- H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
- htri_t ret_value = FALSE; /* Indicate success, but no location change */
+ htri_t ret_value = FALSE; /* Indicate success, but no location change */
FUNC_ENTER_PACKAGE
@@ -293,15 +292,22 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
dt->shared->u.vlen.file = NULL;
break;
- case H5T_LOC_DISK: /* Disk based VL datatype */
+ /* Disk based VL datatype */
+ case H5T_LOC_DISK: {
+ H5VL_file_cont_info_t cont_info = {H5VL_CONTAINER_INFO_VERSION, 0, 0, 0};
+ H5VL_file_get_args_t vol_cb_args; /* Arguments to VOL callback */
+
HDassert(file);
/* Mark this type as being stored on disk */
dt->shared->u.vlen.loc = H5T_LOC_DISK;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_GET_CONT_INFO;
+ vol_cb_args.args.get_cont_info.info = &cont_info;
+
/* Get container info */
- if (H5VL_file_get(file, H5VL_FILE_GET_CONT_INFO, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- &cont_info) < 0)
+ if (H5VL_file_get(file, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to get container info")
/* The datatype size is equal to 4 bytes for the sequence length
@@ -319,6 +325,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
if (H5T_own_vol_obj(dt, file) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINIT, FAIL, "can't give ownership of VOL object")
break;
+ }
case H5T_LOC_BADLOC:
/* Allow undefined location. In H5Odtype.c, H5O_dtype_decode sets undefined
@@ -841,8 +848,9 @@ H5T__vlen_disk_getlen(H5VL_object_t H5_ATTR_UNUSED *file, const void *_vl, size_
static herr_t
H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull)
{
- uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -854,8 +862,12 @@ H5T__vlen_disk_isnull(const H5VL_object_t *file, void *_vl, hbool_t *isnull)
/* Skip the sequence's length */
vl += 4;
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_ISNULL;
+ vol_cb_args.args.is_null.isnull = isnull;
+
/* Check if blob ID is "nil" */
- if (H5VL_blob_specific(file, vl, H5VL_BLOB_ISNULL, isnull) < 0)
+ if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "unable to check if a blob ID is 'nil'")
done:
@@ -877,8 +889,9 @@ done:
static herr_t
H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg)
{
- uint8_t *vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ uint8_t * vl = (uint8_t *)_vl; /* Pointer to the user's hvl_t information */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_STATIC
@@ -895,8 +908,11 @@ H5T__vlen_disk_setnull(H5VL_object_t *file, void *_vl, void *bg)
/* Set the length of the sequence */
UINT32ENCODE(vl, 0);
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_SETNULL;
+
/* Set blob ID to "nil" */
- if (H5VL_blob_specific(file, vl, H5VL_BLOB_SETNULL) < 0)
+ if (H5VL_blob_specific(file, vl, &vol_cb_args) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSET, FAIL, "unable to set a blob ID to 'nil'")
done:
@@ -1013,10 +1029,16 @@ H5T__vlen_disk_delete(H5VL_object_t *file, const void *_vl)
UINT32DECODE(vl, seq_len);
/* Delete object, if length > 0 */
- if (seq_len > 0)
- if (H5VL_blob_specific(file, (void *)vl, H5VL_BLOB_DELETE) < 0) /* Casting away 'const' OK -QAK */
+ if (seq_len > 0) {
+ H5VL_blob_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_BLOB_DELETE;
+
+ if (H5VL_blob_specific(file, (void *)vl, &vol_cb_args) < 0) /* Casting away 'const' OK -QAK */
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTREMOVE, FAIL, "unable to delete blob")
- } /* end if */
+ } /* end if */
+ } /* end if */
done:
FUNC_LEAVE_NOAPI(ret_value)
diff --git a/src/H5VL.c b/src/H5VL.c
index a77a6f3..8c3277c 100644
--- a/src/H5VL.c
+++ b/src/H5VL.c
@@ -655,6 +655,39 @@ done:
FUNC_LEAVE_API(ret_value)
} /* H5VLobject() */
+/*---------------------------------------------------------------------------
+ * Function: H5VLobject_is_native
+ *
+ * Purpose: Determines whether an object ID represents a native VOL
+ * connector object.
+ *
+ * Return: Non-negative on success/Negative on failure
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_is_native(hid_t obj_id, hbool_t *is_native)
+{
+ H5VL_object_t *vol_obj = NULL;
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "i*b", obj_id, is_native);
+
+ if (!is_native)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "`is_native` argument is NULL")
+
+ /* Get the location object for the ID */
+ if (NULL == (vol_obj = H5VL_vol_object(obj_id)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid object identifier")
+
+ if (H5VL_object_is_native(vol_obj, is_native) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine if object is a native connector object")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLobject_is_native() */
+
/*-------------------------------------------------------------------------
* Function: H5VLget_file_type
*
@@ -764,6 +797,39 @@ done:
} /* H5VLretrieve_lib_state() */
/*---------------------------------------------------------------------------
+ * Function: H5VLstart_lib_state
+ *
+ * Purpose: Opens a new internal state for the HDF5 library.
+ *
+ * Note: This routine is _only_ for HDF5 VOL connector authors! It is
+ * _not_ part of the public API for HDF5 application developers.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 5, 2021
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLstart_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ /* Must use this, to avoid modifying the API context stack in FUNC_ENTER */
+ FUNC_ENTER_API_NOINIT
+ H5TRACE0("e", "");
+
+ /* Start a new library state */
+ if (H5VL_start_lib_state() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't start new library state")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* H5VLstart_lib_state() */
+
+/*---------------------------------------------------------------------------
* Function: H5VLrestore_lib_state
*
* Purpose: Restores the internal state of the HDF5 library.
@@ -801,16 +867,16 @@ done:
} /* H5VLrestore_lib_state() */
/*---------------------------------------------------------------------------
- * Function: H5VLreset_lib_state
+ * Function: H5VLfinish_lib_state
*
- * Purpose: Resets the internal state of the HDF5 library, undoing the
- * affects of H5VLrestore_lib_state.
+ * Purpose: Closes the internal state of the HDF5 library, undoing the
+ * affects of H5VLstart_lib_state.
*
* Note: This routine is _only_ for HDF5 VOL connector authors! It is
* _not_ part of the public API for HDF5 application developers.
*
* Note: This routine must be called as a "pair" with
- * H5VLrestore_lib_state. It can be called before / after /
+ * H5VLstart_lib_state. It can be called before / after /
* independently of H5VLfree_lib_state.
*
* Return: Success: Non-negative
@@ -822,7 +888,7 @@ done:
*---------------------------------------------------------------------------
*/
herr_t
-H5VLreset_lib_state(void)
+H5VLfinish_lib_state(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -831,12 +897,12 @@ H5VLreset_lib_state(void)
H5TRACE0("e", "");
/* Reset the library state */
- if (H5VL_reset_lib_state() < 0)
+ if (H5VL_finish_lib_state() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset library state")
done:
FUNC_LEAVE_API_NOINIT(ret_value)
-} /* H5VLreset_lib_state() */
+} /* H5VLfinish_lib_state() */
/*---------------------------------------------------------------------------
* Function: H5VLfree_lib_state
@@ -911,3 +977,136 @@ H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t
done:
FUNC_LEAVE_API(ret_value)
} /* H5VLquery_optional() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLregister_opt_operation
+ *
+ * Purpose: Allow a VOL connector to register a new optional operation
+ * for a VOL object subclass. The operation name must be runtime
+ * unique for each operation, preferably avoiding naming clashes
+ * by using a Uniform Type Identifier (UTI,
+ *https://developer.apple.com/library/archive/documentation/FileManagement/Conceptual/understanding_utis/understand_utis_conc/understand_utis_conc.html)
+ * for each operation name. The value returned in the 'op_val'
+ * pointer will be unique for that VOL connector to use for its
+ * operation on that subclass.
+ *
+ * For example, registering a 'prefetch' operation for the
+ * caching VOL connector written at the ALCF at Argonne National
+ * Laboratory could have a UTI of: "gov.anl.alcf.cache.prefetch",
+ * and the "evict" operation for the same connector could have a
+ * UTI of: "gov.anl.alcf.cache.evict". Registering a "suspend
+ * background threads" operation for the asynchronous VOL connector
+ * written at NERSC at Lawrence Berkeley National Laboratory could
+ * have a UTI of: "gov.lbnl.nersc.async.suspend_bkg_threads".
+ *
+ * Note: The first 1024 values of each subclass's optional operations
+ * are reserved for the native VOL connector's use.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLregister_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "VS*sx", subcls, op_name, op_val);
+
+ /* Check args */
+ if (NULL == op_val)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer")
+ if (NULL == op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer")
+ if ('\0' == *op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string")
+ if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) ||
+ (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) ||
+ (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type")
+
+ /* Register the operation */
+ if (H5VL__register_opt_operation(subcls, op_name, op_val) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, FAIL, "can't register dynamic optional operation: '%s'",
+ op_name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLregister_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLfind_opt_operation
+ *
+ * Purpose: Look up a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLfind_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val /*out*/)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "VS*sx", subcls, op_name, op_val);
+
+ /* Check args */
+ if (NULL == op_val)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_val pointer")
+ if (NULL == op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer")
+ if ('\0' == *op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string")
+ if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) ||
+ (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) ||
+ (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type")
+
+ /* Find the operation */
+ if (H5VL__find_opt_operation(subcls, op_name, op_val) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "can't find dynamic optional operation: '%s'", op_name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLfind_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VLunregister_opt_operation
+ *
+ * Purpose: Unregister a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VLunregister_opt_operation(H5VL_subclass_t subcls, const char *op_name)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE2("e", "VS*s", subcls, op_name);
+
+ /* Check args */
+ if (NULL == op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name pointer")
+ if ('\0' == *op_name)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid op_name string")
+ if (!((H5VL_SUBCLS_ATTR == subcls) || (H5VL_SUBCLS_DATASET == subcls) ||
+ (H5VL_SUBCLS_DATATYPE == subcls) || (H5VL_SUBCLS_FILE == subcls) || (H5VL_SUBCLS_GROUP == subcls) ||
+ (H5VL_SUBCLS_OBJECT == subcls) || (H5VL_SUBCLS_LINK == subcls) || (H5VL_SUBCLS_REQUEST == subcls)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid VOL subclass type")
+
+ /* Unregister the operation */
+ if (H5VL__unregister_opt_operation(subcls, op_name) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "can't unregister dynamic optional operation: '%s'",
+ op_name)
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* H5VLunregister_opt_operation() */
diff --git a/src/H5VLcallback.c b/src/H5VLcallback.c
index 80134a7..fcab19f 100644
--- a/src/H5VLcallback.c
+++ b/src/H5VLcallback.c
@@ -29,11 +29,13 @@
#include "H5private.h" /* Generic Functions */
#include "H5Eprivate.h" /* Error handling */
+#include "H5ESprivate.h" /* Event Sets */
#include "H5Fprivate.h" /* File access */
#include "H5Iprivate.h" /* IDs */
#include "H5MMprivate.h" /* Memory management */
#include "H5Pprivate.h" /* Property lists */
#include "H5PLprivate.h" /* Plugins */
+#include "H5Tprivate.h" /* Datatypes */
#include "H5VLpkg.h" /* Virtual Object Layer */
/****************/
@@ -54,6 +56,10 @@ typedef struct H5VL_file_open_find_connector_t {
hid_t fapl_id;
} H5VL_file_open_find_connector_t;
+/* Typedef for common callback form of registered optional operations */
+typedef herr_t (*H5VL_reg_opt_oper_t)(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
+
/********************/
/* Package Typedefs */
/********************/
@@ -70,13 +76,12 @@ static herr_t H5VL__attr_read(void *obj, const H5VL_class_t *cls, hid_t mem_type
void **req);
static herr_t H5VL__attr_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, const void *buf,
hid_t dxpl_id, void **req);
-static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__attr_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__dataset_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t lcpl_id, hid_t type_id, hid_t space_id,
@@ -87,26 +92,24 @@ static herr_t H5VL__dataset_read(void *dset, const H5VL_class_t *cls, hid_t mem_
hid_t file_space_id, hid_t dxpl_id, void *buf, void **req);
static herr_t H5VL__dataset_write(void *obj, const H5VL_class_t *cls, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req);
-static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls,
- H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__dataset_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__datatype_commit(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t type_id, hid_t lcpl_id, hid_t tcpl_id,
hid_t tapl_id, hid_t dxpl_id, void **req);
static void * H5VL__datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls,
- H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__datatype_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__file_create(const H5VL_class_t *cls, const char *name, unsigned flags, hid_t fcpl_id,
hid_t fapl_id, hid_t dxpl_id, void **req);
@@ -114,28 +117,28 @@ static void * H5VL__file_open(const H5VL_class_t *cls, const char *name, unsigne
hid_t dxpl_id, void **req);
static herr_t H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info,
void *op_data);
-static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__file_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
static void * H5VL__group_create(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t lcpl_id, hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id,
void **req);
static void * H5VL__group_open(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
static herr_t H5VL__group_close(void *obj, const H5VL_class_t *cls, hid_t dxpl_id, void **req);
-static herr_t H5VL__link_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+static herr_t H5VL__link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
+ void **req);
static herr_t H5VL__link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
@@ -143,12 +146,11 @@ static herr_t H5VL__link_move(void *src_obj, const H5VL_loc_params_t *loc_params
const H5VL_loc_params_t *loc_params2, const H5VL_class_t *cls, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
static herr_t H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
static void * H5VL__object_open(void *obj, const H5VL_loc_params_t *params, const H5VL_class_t *cls,
H5I_type_t *opened_type, hid_t dxpl_id, void **req);
static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_params, const char *src_name,
@@ -156,12 +158,11 @@ static herr_t H5VL__object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_
const H5VL_class_t *cls, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id,
void **req);
static herr_t H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL__introspect_get_conn_cls(void *obj, const H5VL_class_t *cls, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
static herr_t H5VL__introspect_opt_query(void *obj, const H5VL_class_t *cls, H5VL_subclass_t subcls,
@@ -170,27 +171,25 @@ static herr_t H5VL__request_wait(void *req, const H5VL_class_t *cls, uint64_t ti
H5VL_request_status_t *status);
static herr_t H5VL__request_notify(void *req, const H5VL_class_t *cls, H5VL_request_notify_t cb, void *ctx);
static herr_t H5VL__request_cancel(void *req, const H5VL_class_t *cls, H5VL_request_status_t *status);
-static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls,
- H5VL_request_specific_t specific_type, va_list arguments);
-static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type,
- va_list arguments);
+static herr_t H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_args_t *args);
+static herr_t H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t *args);
static herr_t H5VL__request_free(void *req, const H5VL_class_t *cls);
static herr_t H5VL__blob_put(void *obj, const H5VL_class_t *cls, const void *buf, size_t size, void *blob_id,
void *ctx);
static herr_t H5VL__blob_get(void *obj, const H5VL_class_t *cls, const void *blob_id, void *buf, size_t size,
void *ctx);
static herr_t H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id,
- H5VL_blob_specific_t specific_type, va_list arguments);
+ H5VL_blob_specific_args_t *args);
static herr_t H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id,
- H5VL_blob_optional_t opt_type, va_list arguments);
+ H5VL_optional_args_t *args);
static herr_t H5VL__token_cmp(void *obj, const H5VL_class_t *cls, const H5O_token_t *token1,
const H5O_token_t *token2, int *cmp_value);
static herr_t H5VL__token_to_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
const H5O_token_t *token, char **token_str);
static herr_t H5VL__token_from_str(void *obj, H5I_type_t obj_type, const H5VL_class_t *cls,
const char *token_str, H5O_token_t *token);
-static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req,
- va_list arguments);
+static herr_t H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
/*********************/
/* Package Variables */
@@ -329,6 +328,50 @@ done:
} /* H5VLget_value */
/*-------------------------------------------------------------------------
+ * Function: H5VL__common_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__common_optional_op(hid_t id, H5I_type_t id_type, H5VL_reg_opt_oper_t reg_opt_op,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req, H5VL_object_t **_vol_obj_ptr)
+{
+ H5VL_object_t * tmp_vol_obj = NULL; /* Object for id */
+ H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for id */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_STATIC
+
+ /* Check ID type & get VOL object */
+ if (NULL == (*vol_obj_ptr = (H5VL_object_t *)H5I_object_verify(id, id_type)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "invalid identifier")
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value =
+ (*reg_opt_op)((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__common_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_copy_connector_info
*
* Purpose: Copy the VOL info for a connector
@@ -1341,8 +1384,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1353,7 +1395,7 @@ H5VL__attr_get(void *obj, const H5VL_class_t *cls, H5VL_attr_get_t get_type, hid
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr get' method")
/* Call the corresponding VOL callback */
- if ((cls->attr_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->attr_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed")
done:
@@ -1371,10 +1413,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1386,16 +1426,10 @@ H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__attr_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "attribute get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -1414,23 +1448,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVaixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid object")
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+ if (NULL == args)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid argument struct")
/* Call the corresponding internal VOL routine */
- if (H5VL__attr_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__attr_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to get attribute information")
done:
@@ -1449,7 +1484,7 @@ done:
*/
static herr_t
H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1460,8 +1495,9 @@ H5VL__attr_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->attr_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->attr_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1479,10 +1515,8 @@ done:
*/
herr_t
H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1494,17 +1528,12 @@ H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type,
- dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value =
+ H5VL__attr_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -1524,13 +1553,13 @@ done:
*/
herr_t
H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req /*out*/, va_list arguments)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVbixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -1539,8 +1568,9 @@ H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__attr_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute 'specific' callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -1557,8 +1587,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -1569,8 +1598,9 @@ H5VL__attr_optional(void *obj, const H5VL_class_t *cls, H5VL_attr_optional_t opt
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'attr optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->attr_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->attr_cls.optional)(obj, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -1587,11 +1617,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -1603,17 +1630,11 @@ H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req,
- arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__attr_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -1632,14 +1653,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVsixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -1648,14 +1669,58 @@ H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__attr_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__attr_optional(obj, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute attribute optional callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLattr_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLattr_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on an attribute
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t attr_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Attribute VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, attr_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the common VOL connector optional routine */
+ if ((ret_value = H5VL__common_optional_op(attr_id, H5I_ATTR, H5VL__attr_optional, args, dxpl_id,
+ token_ptr, &vol_obj)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute attribute optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, attr_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLattr_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__attr_close
*
* Purpose: Closes an attribute through the VOL
@@ -2169,8 +2234,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2181,7 +2246,7 @@ H5VL__dataset_get(void *obj, const H5VL_class_t *cls, H5VL_dataset_get_t get_typ
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset get' method")
/* Call the corresponding VOL callback */
- if ((cls->dataset_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->dataset_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed")
done:
@@ -2199,10 +2264,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2214,16 +2277,10 @@ H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "dataset get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2242,14 +2299,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVcixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2258,7 +2315,7 @@ H5VLdataset_get(void *obj, hid_t connector_id, H5VL_dataset_get_t get_type, hid_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__dataset_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute dataset get callback")
done:
@@ -2276,8 +2333,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2288,7 +2345,7 @@ H5VL__dataset_specific(void *obj, const H5VL_class_t *cls, H5VL_dataset_specific
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset specific' method")
/* Call the corresponding VOL callback */
- if ((cls->dataset_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->dataset_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
done:
@@ -2306,11 +2363,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2322,17 +2377,10 @@ H5VL_dataset_specific(const H5VL_object_t *vol_obj, H5VL_dataset_specific_t spec
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__dataset_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2351,14 +2399,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVdixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2367,7 +2415,7 @@ H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t spec
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__dataset_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset specific callback")
done:
@@ -2385,8 +2433,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2397,7 +2445,7 @@ H5VL__dataset_optional(void *obj, const H5VL_class_t *cls, H5VL_dataset_optional
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'dataset optional' method")
/* Call the corresponding VOL callback */
- if ((cls->dataset_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->dataset_cls.optional)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
@@ -2415,11 +2463,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2431,16 +2476,10 @@ H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2459,14 +2498,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVtixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2475,7 +2514,7 @@ H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__dataset_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__dataset_optional(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
done:
@@ -2483,6 +2522,49 @@ done:
} /* end H5VLdataset_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLdataset_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a dataset
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t dset_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Dataset VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, dset_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__common_optional_op(dset_id, H5I_DATASET, H5VL__dataset_optional, args, dxpl_id, token_ptr,
+ &vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute dataset optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, dset_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLdataset_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__dataset_close
*
* Purpose: Closes a dataset through the VOL
@@ -2807,8 +2889,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2819,8 +2901,8 @@ H5VL__datatype_get(void *obj, const H5VL_class_t *cls, H5VL_datatype_get_t get_t
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype get' method")
/* Call the corresponding VOL callback */
- if ((cls->datatype_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed")
+ if ((cls->datatype_cls.get)(obj, args, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype 'get' failed")
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -2837,10 +2919,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2852,16 +2932,10 @@ H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hi
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "datatype get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2880,14 +2954,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVeixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -2895,12 +2969,8 @@ H5VLdatatype_get(void *obj, hid_t connector_id, H5VL_datatype_get_t get_type, hi
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->datatype_cls.get)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `datatype get' method")
-
/* Call the corresponding internal VOL routine */
- if (H5VL__datatype_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute datatype get callback")
done:
@@ -2918,8 +2988,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2930,7 +3000,7 @@ H5VL__datatype_specific(void *obj, const H5VL_class_t *cls, H5VL_datatype_specif
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype specific' method")
/* Call the corresponding VOL callback */
- if ((cls->datatype_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->datatype_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
done:
@@ -2948,11 +3018,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -2964,17 +3032,10 @@ H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t sp
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__datatype_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -2993,14 +3054,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVfixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3009,7 +3070,7 @@ H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t sp
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__datatype_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype specific callback")
done:
@@ -3027,8 +3088,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3039,7 +3100,7 @@ H5VL__datatype_optional(void *obj, const H5VL_class_t *cls, H5VL_datatype_option
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'datatype optional' method")
/* Call the corresponding VOL callback */
- if ((cls->datatype_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->datatype_cls.optional)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
done:
@@ -3057,11 +3118,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3073,17 +3131,10 @@ H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t op
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) <
- 0)
+ if (H5VL__datatype_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3092,6 +3143,50 @@ done:
} /* end H5VL_datatype_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_datatype_optional_op
+ *
+ * Purpose: Optional operation specific to connectors.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req,
+ H5VL_object_t **_vol_obj_ptr)
+{
+ H5VL_object_t * tmp_vol_obj = NULL; /* Object for id */
+ H5VL_object_t **vol_obj_ptr = (_vol_obj_ptr ? _vol_obj_ptr : &tmp_vol_obj); /* Ptr to object ptr for id */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(vol_obj);
+
+ /* Set up vol_obj_ptr */
+ *vol_obj_ptr = vol_obj;
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(*vol_obj_ptr) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__datatype_optional((*vol_obj_ptr)->data, (*vol_obj_ptr)->connector->cls, args, dxpl_id, req) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_datatype_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VLdatatype_optional
*
* Purpose: Performs an optional connector-specific operation on a datatype
@@ -3102,14 +3197,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVuixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3118,7 +3213,7 @@ H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t op
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__datatype_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__datatype_optional(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute datatype optional callback")
done:
@@ -3126,6 +3221,53 @@ done:
} /* end H5VLdatatype_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLdatatype_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a datatype
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t type_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5T_t * dt; /* Datatype for this operation */
+ H5VL_object_t *vol_obj = NULL; /* Datatype VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, type_id, args, dxpl_id, es_id);
+
+ /* Check args */
+ if (NULL == (dt = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype")
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Only invoke callback if VOL object is set for the datatype */
+ if (H5T_invoke_vol_optional(dt, args, dxpl_id, token_ptr, &vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to invoke datatype optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, type_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLdatatype_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__datatype_close
*
* Purpose: Closes a datatype through the VOL
@@ -3380,14 +3522,16 @@ static herr_t
H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_info, void *op_data)
{
H5VL_file_open_find_connector_t *udata = (H5VL_file_open_find_connector_t *)op_data;
- const H5VL_class_t * cls = (const H5VL_class_t *)plugin_info;
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
+ const H5VL_class_t * cls = (const H5VL_class_t *)plugin_info;
H5P_genplist_t * fapl_plist;
H5P_genplist_t * fapl_plist_copy;
+ hbool_t is_accessible = FALSE; /* Whether file is accessible */
+ ssize_t num_errors = 0;
herr_t status;
- htri_t is_accessible = FALSE;
- hid_t connector_id = H5I_INVALID_HID;
- hid_t fapl_id = H5I_INVALID_HID;
- herr_t ret_value = H5_ITER_CONT;
+ hid_t connector_id = H5I_INVALID_HID;
+ hid_t fapl_id = H5I_INVALID_HID;
+ herr_t ret_value = H5_ITER_CONT;
FUNC_ENTER_STATIC
@@ -3416,19 +3560,40 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in
if (H5P_set_vol(fapl_plist_copy, connector_id, NULL) < 0)
HGOTO_ERROR(H5E_PLIST, H5E_CANTSET, H5_ITER_ERROR, "can't set VOL connector on fapl")
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_ACCESSIBLE;
+ vol_cb_args.args.is_accessible.filename = udata->filename;
+ vol_cb_args.args.is_accessible.fapl_id = fapl_id;
+ vol_cb_args.args.is_accessible.accessible = &is_accessible;
+
+ /* Store current error stack size */
+ if ((num_errors = H5Eget_num(H5E_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size")
+
/* Check if file is accessible with given VOL connector */
H5E_BEGIN_TRY
{
- status = H5VL_file_specific(NULL, H5VL_FILE_IS_ACCESSIBLE, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL,
- fapl_id, udata->filename, &is_accessible);
+ status = H5VL_file_specific(NULL, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, H5_REQUEST_NULL);
}
H5E_END_TRY;
- /* If the file was accessible with the current VOL connector, return
- * the FAPL with that VOL connector set on it. Errors are ignored here
- * as some VOL connectors may not support H5Fis_accessible.
- */
- if (status == SUCCEED && is_accessible > 0) {
+ if (status < 0) {
+ ssize_t new_num_errors = 0;
+
+ /* Pop any errors generated by the above call */
+ if ((new_num_errors = H5Eget_num(H5E_DEFAULT)) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, H5_ITER_ERROR, "can't get current error stack size")
+ if (new_num_errors > num_errors) {
+ new_num_errors -= num_errors;
+ if (H5Epop(H5E_DEFAULT, (size_t)new_num_errors) < 0)
+ HGOTO_ERROR(H5E_ERROR, H5E_CANTRELEASE, H5_ITER_ERROR, "can't sanitize error stack")
+ }
+ }
+ else if (status == SUCCEED && is_accessible) {
+ /* If the file was accessible with the current VOL connector, return
+ * the FAPL with that VOL connector set on it.
+ */
+
/* Modify 'connector_prop' to point to the VOL connector that
* was actually used to open the file, rather than the original
* VOL connector that was requested.
@@ -3438,7 +3603,7 @@ H5VL__file_open_find_connector_cb(H5PL_type_t plugin_type, const void *plugin_in
udata->fapl_id = fapl_id;
ret_value = H5_ITER_STOP;
- } /* end if */
+ }
done:
if (ret_value != H5_ITER_STOP) {
@@ -3479,21 +3644,18 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned
/* Call the corresponding internal VOL routine */
if (NULL == (ret_value = H5VL__file_open(cls, name, flags, fapl_id, dxpl_id, req))) {
- H5VL_file_open_find_connector_t find_connector_ud;
- hbool_t find_connector;
- hbool_t connector_available = FALSE;
+ hbool_t is_default_conn = TRUE;
/* Opening the file failed - Determine whether we should search
* the plugin path to see if any other VOL connectors are available
- * to attempt to open the file with. This only occurs if no particular
- * VOL connector was specified (either via a FAPL or the
- * HDF5_VOL_CONNECTOR environment variable).
+ * to attempt to open the file with. This only occurs if the default
+ * VOL connector was used for the initial file open attempt.
*/
- find_connector = !getenv("HDF5_VOL_CONNECTOR") && ((H5P_FILE_ACCESS_DEFAULT == fapl_id) ||
- connector_prop->connector_id == H5_DEFAULT_VOL);
+ H5VL__is_default_conn(fapl_id, connector_prop->connector_id, &is_default_conn);
- if (find_connector) {
- herr_t iter_ret;
+ if (is_default_conn) {
+ H5VL_file_open_find_connector_t find_connector_ud;
+ herr_t iter_ret;
find_connector_ud.connector_prop = connector_prop;
find_connector_ud.filename = name;
@@ -3505,24 +3667,24 @@ H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned
if (iter_ret < 0)
HGOTO_ERROR(H5E_VOL, H5E_BADITER, NULL,
"failed to iterate over available VOL connector plugins")
- else if (iter_ret)
- connector_available = TRUE;
+ else if (iter_ret) {
+ /* If one of the available VOL connector plugins is
+ * able to open the file, clear the error stack from any
+ * previous file open failures and then open the file.
+ * Otherwise, if no VOL connectors are available, throw
+ * error from original file open failure.
+ */
+ H5E_clear_stack(NULL);
+
+ if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags,
+ find_connector_ud.fapl_id, dxpl_id, req)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL,
+ "can't open file '%s' with VOL connector '%s'", name,
+ find_connector_ud.cls->name)
+ }
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
} /* end if */
-
- /* If one of the available VOL connector plugins is
- * able to open the file, clear the error stack from any
- * previous file open failures and then open the file.
- * Otherwise, if no VOL connectors are available, throw
- * error from original file open failure.
- */
- if (connector_available) {
- H5E_clear_stack(NULL);
-
- if (NULL == (ret_value = H5VL__file_open(find_connector_ud.cls, name, flags,
- find_connector_ud.fapl_id, dxpl_id, req)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "can't open file '%s' with VOL connector '%s'",
- name, find_connector_ud.cls->name)
- }
else
HGOTO_ERROR(H5E_VOL, H5E_CANTOPENOBJ, NULL, "open failed")
} /* end if */
@@ -3581,8 +3743,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3593,7 +3754,7 @@ H5VL__file_get(void *obj, const H5VL_class_t *cls, H5VL_file_get_t get_type, hid
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file get' method")
/* Call the corresponding VOL callback */
- if ((cls->file_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->file_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed")
done:
@@ -3611,10 +3772,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3626,16 +3785,10 @@ H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__file_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "file get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3654,14 +3807,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVgixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3670,7 +3822,7 @@ H5VLfile_get(void *obj, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__file_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute file get callback")
done:
@@ -3688,8 +3840,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3700,7 +3852,7 @@ H5VL__file_specific(void *obj, const H5VL_class_t *cls, H5VL_file_specific_t spe
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file specific' method")
/* Call the corresponding VOL callback */
- if ((cls->file_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->file_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
done:
@@ -3718,33 +3870,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req)
{
const H5VL_class_t *cls; /* VOL connector's class struct */
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Start access to the varargs, so they are available in all situations below */
- HDva_start(arguments, req);
- arg_started = TRUE;
-
/* Special treatment of file access check & delete operations */
/* (Retrieve the VOL connector from the FAPL, since the file isn't open) */
- if (specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE || args->op_type == H5VL_FILE_DELETE) {
H5P_genplist_t * plist; /* Property list pointer */
H5VL_connector_prop_t connector_prop; /* Property for VOL connector ID & info */
- va_list tmp_args; /* argument list passed from the API call */
hid_t fapl_id; /* File access property list for accessing the file */
/* Get the file access property list to access the file */
- HDva_copy(tmp_args, arguments);
- fapl_id = HDva_arg(tmp_args, hid_t);
- HDva_end(tmp_args);
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE)
+ fapl_id = args->args.is_accessible.fapl_id;
+ else {
+ HDassert(args->op_type == H5VL_FILE_DELETE);
+ fapl_id = args->args.del.fapl_id;
+ }
/* Get the VOL info from the FAPL */
if (NULL == (plist = (H5P_genplist_t *)H5I_object(fapl_id)))
@@ -3770,14 +3917,10 @@ H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_t
} /* end else */
/* Call the corresponding internal VOL routine */
- if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_specific(vol_obj ? vol_obj->data : NULL, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3798,21 +3941,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVhixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__file_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file specific callback")
done:
@@ -3830,8 +3973,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -3842,7 +3984,7 @@ H5VL__file_optional(void *obj, const H5VL_class_t *cls, H5VL_file_optional_t opt
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'file optional' method")
/* Call the corresponding VOL callback */
- if ((cls->file_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->file_cls.optional)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
done:
@@ -3860,11 +4002,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -3876,16 +4015,10 @@ H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file optional failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -3904,14 +4037,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVvixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -3920,7 +4053,7 @@ H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__file_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__file_optional(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback")
done:
@@ -3928,6 +4061,49 @@ done:
} /* end H5VLfile_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLfile_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a file
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t file_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* File VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, file_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__common_optional_op(file_id, H5I_FILE, H5VL__file_optional, args, dxpl_id, token_ptr, &vol_obj) <
+ 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute file optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, file_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLfile_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__file_close
*
* Purpose: Closes a file through the VOL
@@ -4244,8 +4420,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4256,7 +4431,7 @@ H5VL__group_get(void *obj, const H5VL_class_t *cls, H5VL_group_get_t get_type, h
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group get' method")
/* Call the corresponding VOL callback */
- if ((cls->group_cls.get)(obj, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->group_cls.get)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed")
done:
@@ -4274,10 +4449,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, ...)
+H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4289,16 +4462,10 @@ H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dx
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__group_get(vol_obj->data, vol_obj->connector->cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__group_get(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "group get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4317,14 +4484,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiViixx", obj, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -4333,7 +4499,7 @@ H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dx
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__group_get(obj, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__group_get(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute group get callback")
done:
@@ -4351,8 +4517,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4363,7 +4529,7 @@ H5VL__group_specific(void *obj, const H5VL_class_t *cls, H5VL_group_specific_t s
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group specific' method")
/* Call the corresponding VOL callback */
- if ((cls->group_cls.specific)(obj, specific_type, dxpl_id, req, arguments) < 0)
+ if ((cls->group_cls.specific)(obj, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
done:
@@ -4381,11 +4547,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, ...)
+H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4397,17 +4560,10 @@ H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, specific_type, dxpl_id, req, arguments) <
- 0)
+ if (H5VL__group_specific(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4426,14 +4582,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVjixx", obj, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -4442,7 +4598,7 @@ H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__group_specific(obj, cls, specific_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__group_specific(obj, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group specific callback")
done:
@@ -4460,8 +4616,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4472,8 +4628,9 @@ H5VL__group_optional(void *obj, const H5VL_class_t *cls, H5VL_group_optional_t o
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'group optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->group_cls.optional)(obj, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->group_cls.optional)(obj, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -4490,11 +4647,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -4506,17 +4660,11 @@ H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req,
- arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__group_optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4535,14 +4683,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVwixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -4551,14 +4699,58 @@ H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__group_optional(obj, cls, opt_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__group_optional(obj, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute group optional callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
} /* end H5VLgroup_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLgroup_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a group
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t group_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t *vol_obj = NULL; /* Group VOL object */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE7("e", "*s*sIui*!ii", app_file, app_func, app_line, group_id, args, dxpl_id, es_id);
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Call the corresponding internal VOL routine */
+ if ((ret_value = H5VL__common_optional_op(group_id, H5I_GROUP, H5VL__group_optional, args, dxpl_id,
+ token_ptr, &vol_obj)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute group optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token,
+ H5ARG_TRACE7(__func__, "*s*sIui*!ii", app_file, app_func, app_line, group_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLgroup_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__group_close
*
* Purpose: Closes a group through the VOL
@@ -4672,9 +4864,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL__link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ const H5VL_class_t *cls, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -4685,7 +4876,7 @@ H5VL__link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link create' method")
/* Call the corresponding VOL callback */
- if ((cls->link_cls.create)(create_type, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
+ if ((cls->link_cls.create)(args, obj, loc_params, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
@@ -4703,31 +4894,19 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
- const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
- ...)
+H5VL_link_create(H5VL_link_create_args_t *args, const H5VL_object_t *vol_obj,
+ const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
{
- H5VL_object_t tmp_vol_obj; /* Temporary object */
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
+ H5VL_object_t tmp_vol_obj; /* Temporary VOL object */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
- /* Start the varargs, so they can be copied */
- HDva_start(arguments, req);
- arg_started = TRUE;
-
/* Special case for hard links */
- if (H5VL_LINK_CREATE_HARD == create_type && NULL == vol_obj->data) {
- va_list tmp_arguments; /* Copy of argument list passed in */
-
- /* Get the VOL data pointer from the varargs */
- HDva_copy(tmp_arguments, arguments);
- tmp_vol_obj.data = HDva_arg(tmp_arguments, void *);
- HDva_end(tmp_arguments);
- } /* end if */
+ if (H5VL_LINK_CREATE_HARD == args->op_type && NULL == vol_obj->data)
+ /* Get the VOL data pointer from the arguments */
+ tmp_vol_obj.data = args->args.hard.curr_obj;
else
/* Use the VOL object passed in */
tmp_vol_obj.data = vol_obj->data;
@@ -4739,15 +4918,11 @@ H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_o
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- if (H5VL__link_create(create_type, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id,
- dxpl_id, req, arguments) < 0)
+ if (H5VL__link_create(args, vol_obj->data, loc_params, vol_obj->connector->cls, lcpl_id, lapl_id, dxpl_id,
+ req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "link create failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -4768,23 +4943,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLlink_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE9("e", "Vk*x*#iiiixx", create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req,
- arguments);
+ H5TRACE8("e", "*!*x*#iiiix", args, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__link_create(create_type, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_create(args, obj, loc_params, cls, lcpl_id, lapl_id, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "unable to create link")
done:
@@ -5017,7 +5190,7 @@ done:
*/
static herr_t
H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5028,7 +5201,7 @@ H5VL__link_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link get' method")
/* Call the corresponding VOL callback */
- if ((cls->link_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->link_cls.get)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
done:
@@ -5046,11 +5219,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
+ hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5062,17 +5233,10 @@ H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__link_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "link get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5091,14 +5255,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req /*out*/, va_list arguments)
+H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_link_get_args_t *args,
+ hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVlixx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5107,7 +5271,7 @@ H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__link_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_get(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute link get callback")
done:
@@ -5126,7 +5290,7 @@ done:
*/
static herr_t
H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5137,8 +5301,9 @@ H5VL__link_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_c
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->link_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->link_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5156,10 +5321,8 @@ done:
*/
herr_t
H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5171,17 +5334,12 @@ H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_pa
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type,
- dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value =
+ H5VL__link_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5201,13 +5359,13 @@ done:
*/
herr_t
H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req /*out*/, va_list arguments)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVmixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5216,8 +5374,9 @@ H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connecto
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__link_specific(obj, loc_params, cls, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__link_specific(obj, loc_params, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute link specific callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -5234,8 +5393,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__link_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5246,7 +5405,7 @@ H5VL__link_optional(void *obj, const H5VL_class_t *cls, H5VL_link_optional_t opt
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'link optional' method")
/* Call the corresponding VOL callback */
- if ((cls->link_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->link_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -5264,11 +5423,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5280,16 +5437,10 @@ H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type,
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__link_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5308,14 +5459,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVxixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5324,7 +5475,7 @@ H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__link_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__link_optional(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
done:
@@ -5332,6 +5483,67 @@ done:
} /* end H5VLlink_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLlink_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a link
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
+ const char *name, hid_t lapl_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id)
+{
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE9("e", "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id,
+ es_id);
+
+ /* Check arguments */
+ /* name is verified in H5VL_setup_name_args() */
+
+ /* Set up object access arguments */
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments")
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__link_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) <
+ 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute link optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLlink_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__object_open
*
* Purpose: Opens a object through the VOL
@@ -5556,7 +5768,7 @@ done:
*/
static herr_t
H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5567,7 +5779,7 @@ H5VL__object_get(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_clas
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object get' method")
/* Call the corresponding VOL callback */
- if ((cls->object_cls.get)(obj, loc_params, get_type, dxpl_id, req, arguments) < 0)
+ if ((cls->object_cls.get)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
done:
@@ -5585,11 +5797,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req, ...)
+H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5601,17 +5811,10 @@ H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_param
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, get_type, dxpl_id, req,
- arguments) < 0)
+ if (H5VL__object_get(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "get failed")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5630,14 +5833,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req /*out*/, va_list arguments)
+H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVnixx", obj, loc_params, connector_id, get_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5646,7 +5849,7 @@ H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_i
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__object_get(obj, loc_params, cls, get_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__object_get(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "unable to execute object get callback")
done:
@@ -5665,7 +5868,7 @@ done:
*/
static herr_t
H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5676,8 +5879,9 @@ H5VL__object_specific(void *obj, const H5VL_loc_params_t *loc_params, const H5VL
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->object_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "object specific failed");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -5695,10 +5899,8 @@ done:
*/
herr_t
H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5710,17 +5912,12 @@ H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, specific_type,
- dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "object specific failed")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = H5VL__object_specific(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id,
+ req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "object specific failed");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5740,14 +5937,13 @@ done:
*/
herr_t
H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req /*out*/,
- va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE7("e", "*x*#iVoixx", obj, loc_params, connector_id, specific_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5755,13 +5951,10 @@ H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connec
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
- /* Check if the corresponding VOL callback exists */
- if (NULL == cls->object_cls.specific)
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no `object specific' method")
-
/* Bypass the H5VLint layer, calling the VOL callback directly */
- if ((ret_value = (cls->object_cls.specific)(obj, loc_params, specific_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object specific callback")
+ /* (Must return value from callback, for iterators) */
+ if ((ret_value = (cls->object_cls.specific)(obj, loc_params, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute object specific callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
@@ -5778,8 +5971,8 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL__object_optional(void *obj, const H5VL_loc_params_t *loc_params, const H5VL_class_t *cls,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -5790,7 +5983,7 @@ H5VL__object_optional(void *obj, const H5VL_class_t *cls, H5VL_object_optional_t
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'object optional' method")
/* Call the corresponding VOL callback */
- if ((cls->object_cls.optional)(obj, opt_type, dxpl_id, req, arguments) < 0)
+ if ((cls->object_cls.optional)(obj, loc_params, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
@@ -5808,11 +6001,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req,
- ...)
+H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -5824,16 +6015,10 @@ H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_ty
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if (H5VL__object_optional(vol_obj->data, vol_obj->connector->cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__object_optional(vol_obj->data, loc_params, vol_obj->connector->cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
@@ -5852,14 +6037,14 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req /*out*/, va_list arguments)
+H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiVyixx", obj, connector_id, opt_type, dxpl_id, req, arguments);
+ H5TRACE6("e", "*x*#i*!ix", obj, loc_params, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -5868,7 +6053,7 @@ H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_ty
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if (H5VL__object_optional(obj, cls, opt_type, dxpl_id, req, arguments) < 0)
+ if (H5VL__object_optional(obj, loc_params, cls, args, dxpl_id, req) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
done:
@@ -5876,6 +6061,68 @@ done:
} /* end H5VLobject_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLobject_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on an object
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_line, hid_t loc_id,
+ const char *name, hid_t lapl_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ hid_t es_id)
+{
+ H5VL_object_t * vol_obj = NULL; /* Object for loc_id */
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ void * token = NULL; /* Request token for async operation */
+ void ** token_ptr = H5_REQUEST_NULL; /* Pointer to request token for async operation */
+ hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE9("e", "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id,
+ es_id);
+
+ /* Check arguments */
+ /* name is verified in H5VL_setup_name_args() */
+
+ /* Set up object access arguments */
+ if (H5VL_setup_name_args(loc_id, name, FALSE, lapl_id, &vol_obj, &loc_params) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set link access arguments")
+
+ /* Set up request token pointer for asynchronous operation */
+ if (H5ES_NONE != es_id)
+ token_ptr = &token; /* Point at token for VOL connector to set up */
+
+ /* Set wrapper info in API context */
+ if (H5VL_set_vol_wrapper(vol_obj) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
+ vol_wrapper_set = TRUE;
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__object_optional(vol_obj->data, &loc_params, vol_obj->connector->cls, args, dxpl_id, token_ptr) <
+ 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute object optional callback")
+
+ /* If a token was created, add the token to the event set */
+ if (NULL != token)
+ /* clang-format off */
+ if (H5ES_insert(es_id, vol_obj->connector, token, H5ARG_TRACE9(__func__, "*s*sIui*si*!ii", app_file, app_func, app_line, loc_id, name, lapl_id, args, dxpl_id, es_id)) < 0)
+ /* clang-format on */
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert token into event set")
+
+done:
+ /* Reset object wrapping info in API context */
+ if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
+
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLobject_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__introspect_get_conn_cls
*
* Purpose: Calls the connector-specific callback to query the connector
@@ -5989,6 +6236,76 @@ done:
} /* end H5VLintrospect_get_conn_cls() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_introspect_get_cap_flags
+ *
+ * Purpose: Calls the connector-specific callback to query the connector's
+ * capability flags.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigned *cap_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(cls);
+ HDassert(cap_flags);
+
+ /* Check if the corresponding VOL callback exists */
+ if (NULL == cls->introspect_cls.get_cap_flags)
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'get_cap_flags' method")
+
+ /* Call the corresponding VOL callback */
+ if ((cls->introspect_cls.get_cap_flags)(info, cap_flags) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector capability flags")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_introspect_get_cap_flags() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VLintrospect_get_cap_flags
+ *
+ * Purpose: Calls the connector-specific callback to query the connector's
+ * capability flags.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap_flags /*out*/)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API_NOINIT
+ H5TRACE3("e", "*xix", info, connector_id, cap_flags);
+
+ /* Check args */
+ if (NULL == cap_flags)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "NULL conn_cls pointer")
+
+ /* Get class pointer */
+ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL_introspect_get_cap_flags(info, cls, cap_flags) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags")
+
+done:
+ FUNC_LEAVE_API_NOINIT(ret_value)
+} /* end H5VLintrospect_get_cap_flags() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__introspect_opt_query
*
* Purpose: Calls the connector-specific callback to query if an optional
@@ -6135,28 +6452,18 @@ done:
herr_t
H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout, H5VL_request_status_t *status)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity checks */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
if (H5VL__request_wait(vol_obj->data, vol_obj->connector->cls, timeout, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request wait failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_wait() */
@@ -6239,28 +6546,18 @@ done:
herr_t
H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
if (H5VL__request_notify(vol_obj->data, vol_obj->connector->cls, cb, ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "request notify failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_notify() */
@@ -6342,28 +6639,18 @@ done:
herr_t
H5VL_request_cancel(const H5VL_object_t *vol_obj, H5VL_request_status_t *status)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
if (H5VL__request_cancel(vol_obj->data, vol_obj->connector->cls, status) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request cancel failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_cancel() */
@@ -6378,13 +6665,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status)
+H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE3("e", "*xi*#", req, connector_id, status);
+ H5TRACE3("e", "*xix", req, connector_id, status);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
@@ -6409,8 +6696,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_t specific_type,
- va_list arguments)
+H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6425,7 +6711,7 @@ H5VL__request_specific(void *req, const H5VL_class_t *cls, H5VL_request_specific
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async specific' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->request_cls.specific)(req, specific_type, arguments)) < 0)
+ if ((cls->request_cls.specific)(req, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request specific callback")
@@ -6444,40 +6730,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...)
+H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, specific_type);
- arg_started = TRUE;
- if ((ret_value =
- H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, specific_type, arguments)) < 0)
+ if (H5VL__request_specific(vol_obj->data, vol_obj->connector->cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_specific() */
@@ -6492,20 +6759,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type, va_list arguments)
+H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE4("e", "*xiVrx", req, connector_id, specific_type, arguments);
+ H5TRACE3("e", "*xi*!", req, connector_id, args);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__request_specific(req, cls, specific_type, arguments)) < 0)
+ if (H5VL__request_specific(req, cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request specific callback")
@@ -6524,8 +6791,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional_t opt_type,
- va_list arguments)
+H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_optional_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6540,7 +6806,7 @@ H5VL__request_optional(void *req, const H5VL_class_t *cls, H5VL_request_optional
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'async optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->request_cls.optional)(req, opt_type, arguments)) < 0)
+ if ((cls->request_cls.optional)(req, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request optional callback")
@@ -6559,39 +6825,21 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...)
+H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, opt_type);
- arg_started = TRUE;
- if ((ret_value = H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, opt_type, arguments)) < 0)
+ if (H5VL__request_optional(vol_obj->data, vol_obj->connector->cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_optional() */
@@ -6606,20 +6854,20 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type, va_list arguments)
+H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE4("e", "*xiVzx", req, connector_id, opt_type, arguments);
+ H5TRACE3("e", "*xi*!", req, connector_id, args);
/* Get class pointer */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__request_optional(req, cls, opt_type, arguments)) < 0)
+ if (H5VL__request_optional(req, cls, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL,
"unable to execute asynchronous request optional callback")
@@ -6628,6 +6876,43 @@ done:
} /* end H5VLrequest_optional() */
/*-------------------------------------------------------------------------
+ * Function: H5VLrequest_optional_op
+ *
+ * Purpose: Performs an optional connector-specific operation on a request
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *args)
+{
+ H5VL_class_t *cls; /* VOL connector's class struct */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_API(FAIL)
+ H5TRACE3("e", "*xi*!", req, connector_id, args);
+
+ /* Check arguments */
+ if (NULL == req)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid request")
+ if (NULL == args)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid arguments")
+
+ /* Get class pointer */
+ if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Call the corresponding internal VOL routine */
+ if (H5VL__request_optional(req, cls, args) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute request optional callback")
+
+done:
+ FUNC_LEAVE_API(ret_value)
+} /* end H5VLrequest_optional_op() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL__request_free
*
* Purpose: Frees an asynchronous request through the VOL
@@ -6673,28 +6958,18 @@ done:
herr_t
H5VL_request_free(const H5VL_object_t *vol_obj)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
/* Sanity check */
HDassert(vol_obj);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding VOL callback */
if (H5VL__request_free(vol_obj->data, vol_obj->connector->cls) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTRELEASE, FAIL, "request free failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_request_free() */
@@ -6778,8 +7053,7 @@ done:
herr_t
H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *blob_id, void *ctx)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -6788,19 +7062,11 @@ H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_t size, void *
HDassert(size == 0 || buf);
HDassert(blob_id);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding VOL callback */
if (H5VL__blob_put(vol_obj->data, vol_obj->connector->cls, buf, size, blob_id, ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "blob put failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_put() */
@@ -6882,8 +7148,7 @@ done:
herr_t
H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size, void *ctx)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -6892,19 +7157,11 @@ H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size
HDassert(blob_id);
HDassert(buf);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding VOL callback */
if (H5VL__blob_get(vol_obj->data, vol_obj->connector->cls, blob_id, buf, size, ctx) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "blob get failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_get() */
@@ -6953,8 +7210,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments)
+H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_specific_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -6970,7 +7226,7 @@ H5VL__blob_specific(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob specific' method")
/* Call the corresponding VOL callback */
- if ((cls->blob_cls.specific)(obj, blob_id, specific_type, arguments) < 0)
+ if ((cls->blob_cls.specific)(obj, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback")
done:
@@ -6988,12 +7244,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_t specific_type, ...)
+H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specific_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7001,27 +7254,11 @@ H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_specif
HDassert(vol_obj);
HDassert(blob_id);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, specific_type);
- arg_started = TRUE;
- if ((ret_value = H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, specific_type,
- arguments)) < 0)
+ if (H5VL__blob_specific(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob specific callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_specific() */
@@ -7035,14 +7272,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments)
+H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specific_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE5("e", "*xi*xVBx", obj, connector_id, blob_id, specific_type, arguments);
+ H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args);
/* Get class pointer */
if (NULL == obj)
@@ -7051,7 +7287,7 @@ H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_specif
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding VOL callback */
- if (H5VL__blob_specific(obj, cls, blob_id, specific_type, arguments) < 0)
+ if (H5VL__blob_specific(obj, cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob specific operation failed")
done:
@@ -7071,8 +7307,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments)
+H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_optional_args_t *args)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -7088,7 +7323,7 @@ H5VL__blob_optional(void *obj, const H5VL_class_t *cls, void *blob_id, H5VL_blob
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'blob optional' method")
/* Call the corresponding VOL callback */
- if ((cls->blob_cls.optional)(obj, blob_id, opt_type, arguments) < 0)
+ if ((cls->blob_cls.optional)(obj, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback")
done:
@@ -7106,12 +7341,9 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type, ...)
+H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_args_t *args)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7119,27 +7351,11 @@ H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_option
HDassert(vol_obj);
HDassert(blob_id);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, opt_type);
- arg_started = TRUE;
- if ((ret_value =
- H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, opt_type, arguments)) < 0)
+ if (H5VL__blob_optional(vol_obj->data, vol_obj->connector->cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute blob optional callback")
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_blob_optional() */
@@ -7153,14 +7369,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments)
+H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_args_t *args)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE5("e", "*xi*xVAx", obj, connector_id, blob_id, opt_type, arguments);
+ H5TRACE4("e", "*xi*x*!", obj, connector_id, blob_id, args);
/* Get class pointer */
if (NULL == obj)
@@ -7169,7 +7384,7 @@ H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_option
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding VOL callback */
- if (H5VL__blob_optional(obj, cls, blob_id, opt_type, arguments) < 0)
+ if (H5VL__blob_optional(obj, cls, blob_id, args) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "blob optional operation failed")
done:
@@ -7243,8 +7458,7 @@ herr_t
H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, const H5O_token_t *token2,
int *cmp_value)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7252,20 +7466,11 @@ H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1, const H5
HDassert(vol_obj);
HDassert(cmp_value);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value)) < 0)
+ if (H5VL__token_cmp(vol_obj->data, vol_obj->connector->cls, token1, token2, cmp_value) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTCOMPARE, FAIL, "token compare failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_token_cmp() */
@@ -7362,8 +7567,7 @@ herr_t
H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const H5O_token_t *token,
char **token_str)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7372,21 +7576,11 @@ H5VL_token_to_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const H5O_t
HDassert(token);
HDassert(token_str);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str)) <
- 0)
+ if (H5VL__token_to_str(vol_obj->data, obj_type, vol_obj->connector->cls, token, token_str) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSERIALIZE, FAIL, "token serialization failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_token_to_str() */
@@ -7480,8 +7674,7 @@ herr_t
H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const char *token_str,
H5O_token_t *token)
{
- hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
- herr_t ret_value = SUCCEED; /* Return value */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_NOAPI(FAIL)
@@ -7490,21 +7683,11 @@ H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_type, const cha
HDassert(token);
HDassert(token_str);
- /* Set wrapper info in API context */
- if (H5VL_set_vol_wrapper(vol_obj) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set VOL wrapper info")
- vol_wrapper_set = TRUE;
-
/* Call the corresponding internal VOL routine */
- if ((ret_value =
- H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token)) < 0)
+ if (H5VL__token_from_str(vol_obj->data, obj_type, vol_obj->connector->cls, token_str, token) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTUNSERIALIZE, FAIL, "token deserialization failed")
done:
- /* Reset object wrapping info in API context */
- if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
-
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_token_from_str() */
@@ -7557,7 +7740,7 @@ done:
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL__optional(void *obj, const H5VL_class_t *cls, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -7568,8 +7751,8 @@ H5VL__optional(void *obj, const H5VL_class_t *cls, int op_type, hid_t dxpl_id, v
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "VOL connector has no 'optional' method")
/* Call the corresponding VOL callback */
- if ((ret_value = (cls->optional)(obj, op_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
+ if ((ret_value = (cls->optional)(obj, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
done:
FUNC_LEAVE_NOAPI(ret_value)
@@ -7586,10 +7769,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...)
+H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
- va_list arguments; /* Argument list passed from the API call */
- hbool_t arg_started = FALSE; /* Whether the va_list has been started */
hbool_t vol_wrapper_set = FALSE; /* Whether the VOL object wrapping context was set up */
herr_t ret_value = SUCCEED; /* Return value */
@@ -7601,20 +7782,13 @@ H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **r
vol_wrapper_set = TRUE;
/* Call the corresponding internal VOL routine */
- HDva_start(arguments, req);
- arg_started = TRUE;
- if ((ret_value =
- H5VL__optional(vol_obj->data, vol_obj->connector->cls, op_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "unable to execute optional callback")
+ if ((ret_value = H5VL__optional(vol_obj->data, vol_obj->connector->cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
done:
- /* End access to the va_list, if we started it */
- if (arg_started)
- HDva_end(arguments);
-
/* Reset object wrapping info in API context */
if (vol_wrapper_set && H5VL_reset_vol_wrapper() < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTRESET, ret_value, "can't reset VOL wrapper info")
+ HDONE_ERROR(H5E_VOL, H5E_CANTRESET, FAIL, "can't reset VOL wrapper info")
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_optional() */
@@ -7630,13 +7804,13 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **req /*out*/, va_list arguments)
+H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id, void **req /*out*/)
{
H5VL_class_t *cls; /* VOL connector's class struct */
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_API_NOINIT
- H5TRACE6("e", "*xiIsixx", obj, connector_id, op_type, dxpl_id, req, arguments);
+ H5TRACE5("e", "*xi*!ix", obj, connector_id, args, dxpl_id, req);
/* Check args and get class pointer */
if (NULL == obj)
@@ -7645,8 +7819,8 @@ H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **r
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a VOL connector ID")
/* Call the corresponding internal VOL routine */
- if ((ret_value = H5VL__optional(obj, cls, op_type, dxpl_id, req, arguments)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, ret_value, "unable to execute optional callback")
+ if ((ret_value = H5VL__optional(obj, cls, args, dxpl_id, req)) < 0)
+ HERROR(H5E_VOL, H5E_CANTOPERATE, "unable to execute optional callback");
done:
FUNC_LEAVE_API_NOINIT(ret_value)
diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h
index 63613bc..af3530c 100644
--- a/src/H5VLconnector.h
+++ b/src/H5VLconnector.h
@@ -20,6 +20,7 @@
/* Public headers needed by this file */
#include "H5public.h" /* Generic Functions */
#include "H5Apublic.h" /* Attributes */
+#include "H5Dpublic.h" /* Datasets */
#include "H5ESpublic.h" /* Event Stack */
#include "H5Fpublic.h" /* Files */
#include "H5Ipublic.h" /* IDs */
@@ -33,8 +34,10 @@
/*****************/
/* Capability flags for connector */
-#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
-#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+#define H5VL_CAP_FLAG_NONE 0 /* No special connector capabilities */
+#define H5VL_CAP_FLAG_THREADSAFE 0x01 /* Connector is threadsafe */
+#define H5VL_CAP_FLAG_ASYNC 0x02 /* Connector performs operations asynchronously*/
+#define H5VL_CAP_FLAG_NATIVE_FILES 0x04 /* Connector produces native file format */
/* Container info version */
#define H5VL_CONTAINER_INFO_VERSION 0x01 /* Container info struct version */
@@ -42,11 +45,64 @@
/* The maximum size allowed for blobs */
#define H5VL_MAX_BLOB_ID_SIZE (16) /* Allow for 128-bits blob IDs */
+/* # of optional operations reserved for the native VOL connector */
+#define H5VL_RESERVED_NATIVE_OPTIONAL 1024
+
/*******************/
/* Public Typedefs */
/*******************/
-/* types for attribute GET callback */
+/* Types for different ways that objects are located in an HDF5 container */
+typedef enum H5VL_loc_type_t {
+ H5VL_OBJECT_BY_SELF,
+ H5VL_OBJECT_BY_NAME,
+ H5VL_OBJECT_BY_IDX,
+ H5VL_OBJECT_BY_TOKEN
+} H5VL_loc_type_t;
+
+typedef struct H5VL_loc_by_name {
+ const char *name;
+ hid_t lapl_id;
+} H5VL_loc_by_name_t;
+
+typedef struct H5VL_loc_by_idx {
+ const char * name;
+ H5_index_t idx_type;
+ H5_iter_order_t order;
+ hsize_t n;
+ hid_t lapl_id;
+} H5VL_loc_by_idx_t;
+
+typedef struct H5VL_loc_by_token {
+ H5O_token_t *token;
+} H5VL_loc_by_token_t;
+
+/* Structure to hold parameters for object locations.
+ * Either: BY_SELF, BY_NAME, BY_IDX, BY_TOKEN
+ *
+ * Note: Leave loc_by_token as the first union member so we
+ * can perform the simplest initialization of the struct
+ * without raising warnings.
+ *
+ * Note: BY_SELF requires no union members.
+ */
+typedef struct H5VL_loc_params_t {
+ H5I_type_t obj_type;
+ H5VL_loc_type_t type;
+ union {
+ H5VL_loc_by_token_t loc_by_token;
+ H5VL_loc_by_name_t loc_by_name;
+ H5VL_loc_by_idx_t loc_by_idx;
+ } loc_data;
+} H5VL_loc_params_t;
+
+/* Struct for all 'optional' callbacks */
+typedef struct H5VL_optional_args_t {
+ int op_type; /* Operation to perform */
+ void *args; /* Pointer to operation's argument struct */
+} H5VL_optional_args_t;
+
+/* Values for attribute 'get' operations */
typedef enum H5VL_attr_get_t {
H5VL_ATTR_GET_ACPL, /* creation property list */
H5VL_ATTR_GET_INFO, /* info */
@@ -56,18 +112,115 @@ typedef enum H5VL_attr_get_t {
H5VL_ATTR_GET_TYPE /* datatype */
} H5VL_attr_get_t;
-/* types for attribute SPECFIC callback */
+/* Parameters for attribute 'get_name' operation */
+typedef struct H5VL_attr_get_name_args_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ size_t buf_size; /* Size of attribute name buffer */
+ char * buf; /* Buffer for attribute name (OUT) */
+ size_t * attr_name_len; /* Actual length of attribute name (OUT) */
+} H5VL_attr_get_name_args_t;
+
+/* Parameters for attribute 'get_info' operation */
+typedef struct H5VL_attr_get_info_args_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ const char * attr_name; /* Attribute name (for get_info_by_name) */
+ H5A_info_t * ainfo; /* Attribute info (OUT) */
+} H5VL_attr_get_info_args_t;
+
+/* Parameters for attribute 'get' operations */
+typedef struct H5VL_attr_get_args_t {
+ H5VL_attr_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_ATTR_GET_ACPL */
+ struct {
+ hid_t acpl_id; /* Attribute creation property list ID (OUT) */
+ } get_acpl;
+
+ /* H5VL_ATTR_GET_INFO */
+ H5VL_attr_get_info_args_t get_info; /* Attribute info */
+
+ /* H5VL_ATTR_GET_NAME */
+ H5VL_attr_get_name_args_t get_name; /* Attribute name */
+
+ /* H5VL_ATTR_GET_SPACE */
+ struct {
+ hid_t space_id; /* Dataspace ID (OUT) */
+ } get_space;
+
+ /* H5VL_ATTR_GET_STORAGE_SIZE */
+ struct {
+ hsize_t *data_size; /* Size of attribute in file (OUT) */
+ } get_storage_size;
+
+ /* H5VL_ATTR_GET_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID (OUT) */
+ } get_type;
+ } args;
+} H5VL_attr_get_args_t;
+
+/* Values for attribute 'specific' operation */
typedef enum H5VL_attr_specific_t {
- H5VL_ATTR_DELETE, /* H5Adelete(_by_name/idx) */
- H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */
- H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */
- H5VL_ATTR_RENAME /* H5Arename(_by_name) */
+ H5VL_ATTR_DELETE, /* H5Adelete(_by_name) */
+ H5VL_ATTR_DELETE_BY_IDX, /* H5Adelete_by_idx */
+ H5VL_ATTR_EXISTS, /* H5Aexists(_by_name) */
+ H5VL_ATTR_ITER, /* H5Aiterate(_by_name) */
+ H5VL_ATTR_RENAME /* H5Arename(_by_name) */
} H5VL_attr_specific_t;
+/* Parameters for attribute 'iterate' operation */
+typedef struct H5VL_attr_iterate_args_t {
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ hsize_t * idx; /* Start/stop iteration index (IN/OUT) */
+ H5A_operator2_t op; /* Iteration callback function */
+ void * op_data; /* Iteration callback context */
+} H5VL_attr_iterate_args_t;
+
+/* Parameters for attribute 'delete_by_idx' operation */
+typedef struct H5VL_attr_delete_by_idx_args_t {
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ hsize_t n; /* Iteration index */
+} H5VL_attr_delete_by_idx_args_t;
+
+/* Parameters for attribute 'specific' operations */
+typedef struct H5VL_attr_specific_args_t {
+ H5VL_attr_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_ATTR_DELETE */
+ struct {
+ const char *name; /* Name of attribute to delete */
+ } del;
+
+ /* H5VL_ATTR_DELETE_BY_IDX */
+ H5VL_attr_delete_by_idx_args_t delete_by_idx;
+
+ /* H5VL_ATTR_EXISTS */
+ struct {
+ const char *name; /* Name of attribute to check */
+ hbool_t * exists; /* Whether attribute exists (OUT) */
+ } exists;
+
+ /* H5VL_ATTR_ITER */
+ H5VL_attr_iterate_args_t iterate;
+
+ /* H5VL_ATTR_RENAME */
+ struct {
+ const char *old_name; /* Name of attribute to rename */
+ const char *new_name; /* New attribute name */
+ } rename;
+ } args;
+} H5VL_attr_specific_args_t;
+
/* Typedef for VOL connector attribute optional VOL operations */
typedef int H5VL_attr_optional_t;
-/* types for dataset GET callback */
+/* Values for dataset 'get' operation */
typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_DAPL, /* access property list */
H5VL_DATASET_GET_DCPL, /* creation property list */
@@ -77,32 +230,146 @@ typedef enum H5VL_dataset_get_t {
H5VL_DATASET_GET_TYPE /* datatype */
} H5VL_dataset_get_t;
-/* types for dataset SPECFIC callback */
+/* Parameters for dataset 'get' operations */
+typedef struct H5VL_dataset_get_args_t {
+ H5VL_dataset_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATASET_GET_DAPL */
+ struct {
+ hid_t dapl_id; /* Dataset access property list ID (OUT) */
+ } get_dapl;
+
+ /* H5VL_DATASET_GET_DCPL */
+ struct {
+ hid_t dcpl_id; /* Dataset creation property list ID (OUT) */
+ } get_dcpl;
+
+ /* H5VL_DATASET_GET_SPACE */
+ struct {
+ hid_t space_id; /* Dataspace ID (OUT) */
+ } get_space;
+
+ /* H5VL_DATASET_GET_SPACE_STATUS */
+ struct {
+ H5D_space_status_t *status; /* Storage space allocation status (OUT) */
+ } get_space_status;
+
+ /* H5VL_DATASET_GET_STORAGE_SIZE */
+ struct {
+ hsize_t *storage_size; /* Size of dataset's storage (OUT) */
+ } get_storage_size;
+
+ /* H5VL_DATASET_GET_TYPE */
+ struct {
+ hid_t type_id; /* Datatype ID (OUT) */
+ } get_type;
+ } args;
+} H5VL_dataset_get_args_t;
+
+/* Values for dataset 'specific' operation */
typedef enum H5VL_dataset_specific_t {
H5VL_DATASET_SET_EXTENT, /* H5Dset_extent */
H5VL_DATASET_FLUSH, /* H5Dflush */
- H5VL_DATASET_REFRESH, /* H5Drefresh */
- H5VL_DATASET_WAIT, /* H5Dwait */
- H5VL_DATASET_CHUNK_ITER /* H5Dchunk_iter */
+ H5VL_DATASET_REFRESH /* H5Drefresh */
} H5VL_dataset_specific_t;
+/* Parameters for dataset 'specific' operations */
+typedef struct H5VL_dataset_specific_args_t {
+ H5VL_dataset_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATASET_SET_EXTENT */
+ struct {
+ const hsize_t *size; /* New dataspace extent */
+ } set_extent;
+
+ /* H5VL_DATASET_FLUSH */
+ struct {
+ hid_t dset_id; /* Dataset ID (IN) */
+ } flush;
+
+ /* H5VL_DATASET_REFRESH */
+ struct {
+ hid_t dset_id; /* Dataset ID (IN) */
+ } refresh;
+ } args;
+} H5VL_dataset_specific_args_t;
+
/* Typedef for VOL connector dataset optional VOL operations */
typedef int H5VL_dataset_optional_t;
-/* types for datatype GET callback */
+/* Values for datatype 'get' operation */
typedef enum H5VL_datatype_get_t {
- H5VL_DATATYPE_GET_BINARY, /* get serialized form of transient type */
- H5VL_DATATYPE_GET_TCPL /* datatype creation property list */
+ H5VL_DATATYPE_GET_BINARY_SIZE, /* Get size of serialized form of transient type */
+ H5VL_DATATYPE_GET_BINARY, /* Get serialized form of transient type */
+ H5VL_DATATYPE_GET_TCPL /* Datatype creation property list */
} H5VL_datatype_get_t;
-/* types for datatype SPECFIC callback */
-typedef enum H5VL_datatype_specific_t { H5VL_DATATYPE_FLUSH, H5VL_DATATYPE_REFRESH } H5VL_datatype_specific_t;
+/* Parameters for datatype 'get' operations */
+typedef struct H5VL_datatype_get_args_t {
+ H5VL_datatype_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATATYPE_GET_BINARY_SIZE */
+ struct {
+ size_t *size; /* Size of serialized form of datatype (OUT) */
+ } get_binary_size;
+
+ /* H5VL_DATATYPE_GET_BINARY */
+ struct {
+ void * buf; /* Buffer to store serialized form of datatype (OUT) */
+ size_t buf_size; /* Size of serialized datatype buffer */
+ } get_binary;
+
+ /* H5VL_DATATYPE_GET_TCPL */
+ struct {
+ hid_t tcpl_id; /* Named datatype creation property list ID (OUT) */
+ } get_tcpl;
+ } args;
+} H5VL_datatype_get_args_t;
+
+/* Values for datatype 'specific' operation */
+typedef enum H5VL_datatype_specific_t {
+ H5VL_DATATYPE_FLUSH, /* H5Tflush */
+ H5VL_DATATYPE_REFRESH /* H5Trefresh */
+} H5VL_datatype_specific_t;
+
+/* Parameters for datatype 'specific' operations */
+typedef struct H5VL_datatype_specific_args_t {
+ H5VL_datatype_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_DATATYPE_FLUSH */
+ struct {
+ hid_t type_id; /* Named datatype ID (IN) */
+ } flush;
+
+ /* H5VL_DATATYPE_REFRESH */
+ struct {
+ hid_t type_id; /* Named datatype ID (IN) */
+ } refresh;
+ } args;
+} H5VL_datatype_specific_args_t;
/* Typedef and values for native VOL connector named datatype optional VOL operations */
typedef int H5VL_datatype_optional_t;
/* (No optional named datatype VOL operations currently) */
-/* types for file GET callback */
+/* Info for H5VL_FILE_GET_CONT_INFO */
+typedef struct H5VL_file_cont_info_t {
+ unsigned version; /* version information (keep first) */
+ uint64_t feature_flags; /* Container feature flags */
+ /* (none currently defined) */
+ size_t token_size; /* Size of tokens */
+ size_t blob_id_size; /* Size of blob IDs */
+} H5VL_file_cont_info_t;
+
+/* Values for file 'get' operation */
typedef enum H5VL_file_get_t {
H5VL_FILE_GET_CONT_INFO, /* file get container info */
H5VL_FILE_GET_FAPL, /* file access property list */
@@ -114,59 +381,296 @@ typedef enum H5VL_file_get_t {
H5VL_FILE_GET_OBJ_IDS /* object ids in file */
} H5VL_file_get_t;
-/* types for file SPECIFIC callback */
+/* Parameters for file 'get_name' operation */
+typedef struct H5VL_file_get_name_args_t {
+ H5I_type_t type; /* ID type of object pointer */
+ size_t buf_size; /* Size of file name buffer (IN) */
+ char * buf; /* Buffer for file name (OUT) */
+ size_t * file_name_len; /* Actual length of file name (OUT) */
+} H5VL_file_get_name_args_t;
+
+/* Parameters for file 'get_obj_ids' operation */
+typedef struct H5VL_file_get_obj_ids_args_t {
+ unsigned types; /* Type of objects to count */
+ size_t max_objs; /* Size of array of object IDs */
+ hid_t * oid_list; /* Array of object IDs (OUT) */
+ size_t * count; /* # of objects (OUT) */
+} H5VL_file_get_obj_ids_args_t;
+
+/* Parameters for file 'get' operations */
+typedef struct H5VL_file_get_args_t {
+ H5VL_file_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_FILE_GET_CONT_INFO */
+ struct {
+ H5VL_file_cont_info_t *info; /* Container info (OUT) */
+ } get_cont_info;
+
+ /* H5VL_FILE_GET_FAPL */
+ struct {
+ hid_t fapl_id; /* File access property list (OUT) */
+ } get_fapl;
+
+ /* H5VL_FILE_GET_FCPL */
+ struct {
+ hid_t fcpl_id; /* File creation property list (OUT) */
+ } get_fcpl;
+
+ /* H5VL_FILE_GET_FILENO */
+ struct {
+ unsigned long *fileno; /* File "number" (OUT) */
+ } get_fileno;
+
+ /* H5VL_FILE_GET_INTENT */
+ struct {
+ unsigned *flags; /* File open/create intent flags (OUT) */
+ } get_intent;
+
+ /* H5VL_FILE_GET_NAME */
+ H5VL_file_get_name_args_t get_name;
+
+ /* H5VL_FILE_GET_OBJ_COUNT */
+ struct {
+ unsigned types; /* Type of objects to count */
+ size_t * count; /* # of objects (OUT) */
+ } get_obj_count;
+
+ /* H5VL_FILE_GET_OBJ_IDS */
+ H5VL_file_get_obj_ids_args_t get_obj_ids;
+ } args;
+} H5VL_file_get_args_t;
+
+/* Values for file 'specific' operation */
typedef enum H5VL_file_specific_t {
H5VL_FILE_FLUSH, /* Flush file */
H5VL_FILE_REOPEN, /* Reopen the file */
- H5VL_FILE_MOUNT, /* Mount a file */
- H5VL_FILE_UNMOUNT, /* Unmount a file */
H5VL_FILE_IS_ACCESSIBLE, /* Check if a file is accessible */
H5VL_FILE_DELETE, /* Delete a file */
- H5VL_FILE_IS_EQUAL, /* Check if two files are the same */
- H5VL_FILE_WAIT /* Wait for async operations to complete */
+ H5VL_FILE_IS_EQUAL /* Check if two files are the same */
} H5VL_file_specific_t;
+/* Parameters for file 'specific' operations */
+typedef struct H5VL_file_specific_args_t {
+ H5VL_file_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_FILE_FLUSH */
+ struct {
+ H5I_type_t obj_type; /* Type of object to use */
+ H5F_scope_t scope; /* Scope of flush operation */
+ } flush;
+
+ /* H5VL_FILE_REOPEN */
+ struct {
+ void **file; /* File object for new file (OUT) */
+ } reopen;
+
+ /* H5VL_FILE_IS_ACCESSIBLE */
+ struct {
+ const char *filename; /* Name of file to check */
+ hid_t fapl_id; /* File access property list to use */
+ hbool_t * accessible; /* Whether file is accessible with FAPL settings (OUT) */
+ } is_accessible;
+
+ /* H5VL_FILE_DELETE */
+ struct {
+ const char *filename; /* Name of file to delete */
+ hid_t fapl_id; /* File access property list to use */
+ } del;
+
+ /* H5VL_FILE_IS_EQUAL */
+ struct {
+ void * obj2; /* Second file object to compare against */
+ hbool_t *same_file; /* Whether files are the same (OUT) */
+ } is_equal;
+ } args;
+} H5VL_file_specific_args_t;
+
/* Typedef for VOL connector file optional VOL operations */
typedef int H5VL_file_optional_t;
-/* types for group GET callback */
+/* Values for group 'get' operation */
typedef enum H5VL_group_get_t {
H5VL_GROUP_GET_GCPL, /* group creation property list */
H5VL_GROUP_GET_INFO /* group info */
} H5VL_group_get_t;
-/* types for group SPECFIC callback */
-typedef enum H5VL_group_specific_t { H5VL_GROUP_FLUSH, H5VL_GROUP_REFRESH } H5VL_group_specific_t;
+/* Parameters for group 'get_info' operation */
+typedef struct H5VL_group_get_info_args_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for object access */
+ H5G_info_t * ginfo; /* Group info (OUT) */
+} H5VL_group_get_info_args_t;
+
+/* Parameters for group 'get' operations */
+typedef struct H5VL_group_get_args_t {
+ H5VL_group_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_GROUP_GET_GCPL */
+ struct {
+ hid_t gcpl_id; /* Group creation property list (OUT) */
+ } get_gcpl;
+
+ /* H5VL_GROUP_GET_INFO */
+ H5VL_group_get_info_args_t get_info; /* Group info */
+ } args;
+} H5VL_group_get_args_t;
+
+/* Values for group 'specific' operation */
+typedef enum H5VL_group_specific_t {
+ H5VL_GROUP_MOUNT, /* Mount a file on a group */
+ H5VL_GROUP_UNMOUNT, /* Unmount a file on a group */
+ H5VL_GROUP_FLUSH, /* H5Gflush */
+ H5VL_GROUP_REFRESH /* H5Grefresh */
+} H5VL_group_specific_t;
+
+/* Parameters for group 'mount' operation */
+typedef struct H5VL_group_spec_mount_args_t {
+ const char *name; /* Name of location to mount child file */
+ void * child_file; /* Pointer to child file object */
+ hid_t fmpl_id; /* File mount property list to use */
+} H5VL_group_spec_mount_args_t;
+
+/* Parameters for group 'specific' operations */
+typedef struct H5VL_group_specific_args_t {
+ H5VL_group_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_GROUP_MOUNT */
+ H5VL_group_spec_mount_args_t mount;
+
+ /* H5VL_GROUP_UNMOUNT */
+ struct {
+ const char *name; /* Name of location to unmount child file */
+ } unmount;
+
+ /* H5VL_GROUP_FLUSH */
+ struct {
+ hid_t grp_id; /* Group ID (IN) */
+ } flush;
+
+ /* H5VL_GROUP_REFRESH */
+ struct {
+ hid_t grp_id; /* Group ID (IN) */
+ } refresh;
+ } args;
+} H5VL_group_specific_args_t;
/* Typedef for VOL connector group optional VOL operations */
typedef int H5VL_group_optional_t;
-/* link create types for VOL */
-typedef enum H5VL_link_create_type_t {
+/* Link create types for VOL */
+typedef enum H5VL_link_create_t {
H5VL_LINK_CREATE_HARD,
H5VL_LINK_CREATE_SOFT,
H5VL_LINK_CREATE_UD
-} H5VL_link_create_type_t;
+} H5VL_link_create_t;
-/* types for link GET callback */
+/* Parameters for link 'create' operations */
+typedef struct H5VL_link_create_args_t {
+ H5VL_link_create_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_LINK_CREATE_HARD */
+ struct {
+ void * curr_obj; /* Current object */
+ H5VL_loc_params_t curr_loc_params; /* Location parameters for current object */
+ } hard;
+
+ /* H5VL_LINK_CREATE_SOFT */
+ struct {
+ const char *target; /* Target of soft link */
+ } soft;
+
+ /* H5VL_LINK_CREATE_UD */
+ struct {
+ H5L_type_t type; /* Type of link to create */
+ const void *buf; /* Buffer that contains link info */
+ size_t buf_size; /* Size of link info buffer */
+ } ud;
+ } args;
+} H5VL_link_create_args_t;
+
+/* Values for link 'get' operation */
typedef enum H5VL_link_get_t {
H5VL_LINK_GET_INFO, /* link info */
H5VL_LINK_GET_NAME, /* link name */
H5VL_LINK_GET_VAL /* link value */
} H5VL_link_get_t;
-/* types for link SPECIFIC callback */
+/* Parameters for link 'get' operations */
+typedef struct H5VL_link_get_args_t {
+ H5VL_link_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_LINK_GET_INFO */
+ struct {
+ H5L_info2_t *linfo; /* Pointer to link's info (OUT) */
+ } get_info;
+
+ /* H5VL_LINK_GET_NAME */
+ struct {
+ size_t name_size; /* Size of link name buffer (IN) */
+ char * name; /* Buffer for link name (OUT) */
+ size_t *name_len; /* Actual length of link name (OUT) */
+ } get_name;
+
+ /* H5VL_LINK_GET_VAL */
+ struct {
+ size_t buf_size; /* Size of link value buffer (IN) */
+ void * buf; /* Buffer for link value (OUT) */
+ } get_val;
+ } args;
+} H5VL_link_get_args_t;
+
+/* Values for link 'specific' operation */
typedef enum H5VL_link_specific_t {
H5VL_LINK_DELETE, /* H5Ldelete(_by_idx) */
H5VL_LINK_EXISTS, /* link existence */
H5VL_LINK_ITER /* H5Literate/visit(_by_name) */
} H5VL_link_specific_t;
+/* Parameters for link 'iterate' operation */
+typedef struct H5VL_link_iterate_args_t {
+ hbool_t recursive; /* Whether iteration is recursive */
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ hsize_t * idx_p; /* Start/stop iteration index (OUT) */
+ H5L_iterate2_t op; /* Iteration callback function */
+ void * op_data; /* Iteration callback context */
+} H5VL_link_iterate_args_t;
+
+/* Parameters for link 'specific' operations */
+typedef struct H5VL_link_specific_args_t {
+ H5VL_link_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_LINK_DELETE */
+ /* No args */
+
+ /* H5VL_LINK_EXISTS */
+ struct {
+ hbool_t *exists; /* Whether link exists (OUT) */
+ } exists;
+
+ /* H5VL_LINK_ITER */
+ H5VL_link_iterate_args_t iterate;
+ } args;
+} H5VL_link_specific_args_t;
+
/* Typedef and values for native VOL connector link optional VOL operations */
typedef int H5VL_link_optional_t;
/* (No optional link VOL operations currently) */
-/* types for object GET callback */
+/* Values for object 'get' operation */
typedef enum H5VL_object_get_t {
H5VL_OBJECT_GET_FILE, /* object file */
H5VL_OBJECT_GET_NAME, /* object name */
@@ -174,7 +678,38 @@ typedef enum H5VL_object_get_t {
H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name) */
} H5VL_object_get_t;
-/* types for object SPECIFIC callback */
+/* Parameters for object 'get' operations */
+typedef struct H5VL_object_get_args_t {
+ H5VL_object_get_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_OBJECT_GET_FILE */
+ struct {
+ void **file; /* File object (OUT) */
+ } get_file;
+
+ /* H5VL_OBJECT_GET_NAME */
+ struct {
+ size_t buf_size; /* Size of name buffer (IN) */
+ char * buf; /* Buffer for name (OUT) */
+ size_t *name_len; /* Actual length of name (OUT) */
+ } get_name;
+
+ /* H5VL_OBJECT_GET_TYPE */
+ struct {
+ H5O_type_t *obj_type; /* Type of object (OUT) */
+ } get_type;
+
+ /* H5VL_OBJECT_GET_INFO */
+ struct {
+ unsigned fields; /* Flags for fields to retrieve */
+ H5O_info2_t *oinfo; /* Pointer to object info (OUT) */
+ } get_info;
+ } args;
+} H5VL_object_get_args_t;
+
+/* Values for object 'specific' operation */
typedef enum H5VL_object_specific_t {
H5VL_OBJECT_CHANGE_REF_COUNT, /* H5Oincr/decr_refcount */
H5VL_OBJECT_EXISTS, /* H5Oexists_by_name */
@@ -184,6 +719,51 @@ typedef enum H5VL_object_specific_t {
H5VL_OBJECT_REFRESH /* H5{D|G|O|T}refresh */
} H5VL_object_specific_t;
+/* Parameters for object 'visit' operation */
+typedef struct H5VL_object_visit_args_t {
+ H5_index_t idx_type; /* Type of index to iterate over */
+ H5_iter_order_t order; /* Order of index iteration */
+ unsigned fields; /* Flags for fields to provide in 'info' object for 'op' callback */
+ H5O_iterate2_t op; /* Iteration callback function */
+ void * op_data; /* Iteration callback context */
+} H5VL_object_visit_args_t;
+
+/* Parameters for object 'specific' operations */
+typedef struct H5VL_object_specific_args_t {
+ H5VL_object_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_OBJECT_CHANGE_REF_COUNT */
+ struct {
+ int delta; /* Amount to modify object's refcount */
+ } change_rc;
+
+ /* H5VL_OBJECT_EXISTS */
+ struct {
+ hbool_t *exists; /* Whether object exists (OUT) */
+ } exists;
+
+ /* H5VL_OBJECT_LOOKUP */
+ struct {
+ H5O_token_t *token_ptr; /* Pointer to token for lookup (OUT) */
+ } lookup;
+
+ /* H5VL_OBJECT_VISIT */
+ H5VL_object_visit_args_t visit;
+
+ /* H5VL_OBJECT_FLUSH */
+ struct {
+ hid_t obj_id; /* Object ID (IN) */
+ } flush;
+
+ /* H5VL_OBJECT_REFRESH */
+ struct {
+ hid_t obj_id; /* Object ID (IN) */
+ } refresh;
+ } args;
+} H5VL_object_specific_args_t;
+
/* Typedef for VOL connector object optional VOL operations */
typedef int H5VL_object_optional_t;
@@ -200,82 +780,64 @@ typedef enum H5VL_request_status_t {
H5VL_REQUEST_STATUS_CANCELED /* Operation has not completed and was canceled */
} H5VL_request_status_t;
-/* types for async request SPECIFIC callback */
+/* Values for async request 'specific' operation */
typedef enum H5VL_request_specific_t {
- H5VL_REQUEST_WAITANY, /* Wait until any request completes */
- H5VL_REQUEST_WAITSOME, /* Wait until at least one requesst completes */
- H5VL_REQUEST_WAITALL, /* Wait until all requests complete */
- H5VL_REQUEST_GET_ERR_STACK /* Retrieve error stack for failed operation */
+ H5VL_REQUEST_GET_ERR_STACK, /* Retrieve error stack for failed operation */
+ H5VL_REQUEST_GET_EXEC_TIME /* Retrieve execution time for operation */
} H5VL_request_specific_t;
+/* Parameters for request 'specific' operations */
+typedef struct H5VL_request_specific_args_t {
+ H5VL_request_specific_t op_type; /* Operation to perform */
+
+ /* Parameters for each operation */
+ union {
+ /* H5VL_REQUEST_GET_ERR_STACK */
+ struct {
+ hid_t err_stack_id; /* Error stack ID for operation (OUT) */
+ } get_err_stack;
+
+ /* H5VL_REQUEST_GET_EXEC_TIME */
+ struct {
+ uint64_t *exec_ts; /* Timestamp for start of task execution (OUT) */
+ uint64_t *exec_time; /* Duration of task execution (in ns) (OUT) */
+ } get_exec_time;
+ } args;
+} H5VL_request_specific_args_t;
+
/* Typedef and values for native VOL connector request optional VOL operations */
typedef int H5VL_request_optional_t;
/* (No optional request VOL operations currently) */
-/* types for 'blob' SPECIFIC callback */
+/* Values for 'blob' 'specific' operation */
typedef enum H5VL_blob_specific_t {
- H5VL_BLOB_DELETE, /* Delete a blob (by ID) */
- H5VL_BLOB_GETSIZE, /* Get size of blob */
- H5VL_BLOB_ISNULL, /* Check if a blob ID is "null" */
- H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */
+ H5VL_BLOB_DELETE, /* Delete a blob (by ID) */
+ H5VL_BLOB_ISNULL, /* Check if a blob ID is "null" */
+ H5VL_BLOB_SETNULL /* Set a blob ID to the connector's "null" blob ID value */
} H5VL_blob_specific_t;
-/* Typedef and values for native VOL connector blob optional VOL operations */
-typedef int H5VL_blob_optional_t;
-/* (No optional blob VOL operations currently) */
-
-/* Types for different ways that objects are located in an HDF5 container */
-typedef enum H5VL_loc_type_t {
- H5VL_OBJECT_BY_SELF,
- H5VL_OBJECT_BY_NAME,
- H5VL_OBJECT_BY_IDX,
- H5VL_OBJECT_BY_TOKEN
-} H5VL_loc_type_t;
+/* Parameters for blob 'specific' operations */
+typedef struct H5VL_blob_specific_args_t {
+ H5VL_blob_specific_t op_type; /* Operation to perform */
-typedef struct H5VL_loc_by_name {
- const char *name;
- hid_t lapl_id;
-} H5VL_loc_by_name_t;
-
-typedef struct H5VL_loc_by_idx {
- const char * name;
- H5_index_t idx_type;
- H5_iter_order_t order;
- hsize_t n;
- hid_t lapl_id;
-} H5VL_loc_by_idx_t;
+ /* Parameters for each operation */
+ union {
+ /* H5VL_BLOB_DELETE */
+ /* No args */
-typedef struct H5VL_loc_by_token {
- H5O_token_t *token;
-} H5VL_loc_by_token_t;
+ /* H5VL_BLOB_ISNULL */
+ struct {
+ hbool_t *isnull; /* Whether blob ID is "null" (OUT) */
+ } is_null;
-/* Structure to hold parameters for object locations.
- * Either: BY_SELF, BY_NAME, BY_IDX, BY_TOKEN
- *
- * Note: Leave loc_by_token as the first union member so we
- * can perform the simplest initialization of the struct
- * without raising warnings.
- *
- * Note: BY_SELF requires no union members.
- */
-typedef struct H5VL_loc_params_t {
- H5I_type_t obj_type;
- H5VL_loc_type_t type;
- union {
- H5VL_loc_by_token_t loc_by_token;
- H5VL_loc_by_name_t loc_by_name;
- H5VL_loc_by_idx_t loc_by_idx;
- } loc_data;
-} H5VL_loc_params_t;
+ /* H5VL_BLOB_SETNULL */
+ /* No args */
+ } args;
+} H5VL_blob_specific_args_t;
-/* Info for H5VL_FILE_GET_CONT_INFO */
-typedef struct H5VL_file_cont_info_t {
- unsigned version; /* version information (keep first) */
- uint64_t feature_flags; /* Container feature flags */
- /* (none currently defined) */
- size_t token_size; /* Size of tokens */
- size_t blob_id_size; /* Size of blob IDs */
-} H5VL_file_cont_info_t;
+/* Typedef and values for native VOL connector blob optional VOL operations */
+typedef int H5VL_blob_optional_t;
+/* (No optional blob VOL operations currently) */
/* VOL connector info fields & callbacks */
typedef struct H5VL_info_class_t {
@@ -310,11 +872,10 @@ typedef struct H5VL_attr_class_t {
hid_t dxpl_id, void **req);
herr_t (*read)(void *attr, hid_t mem_type_id, void *buf, hid_t dxpl_id, void **req);
herr_t (*write)(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *attr, hid_t dxpl_id, void **req);
} H5VL_attr_class_t;
@@ -328,11 +889,9 @@ typedef struct H5VL_dataset_class_t {
void *buf, void **req);
herr_t (*write)(void *dset, hid_t mem_type_id, hid_t mem_space_id, hid_t file_space_id, hid_t dxpl_id,
const void *buf, void **req);
- herr_t (*get)(void *obj, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *dset, hid_t dxpl_id, void **req);
} H5VL_dataset_class_t;
@@ -342,11 +901,9 @@ typedef struct H5VL_datatype_class_t {
hid_t lcpl_id, hid_t tcpl_id, hid_t tapl_id, hid_t dxpl_id, void **req);
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t tapl_id,
hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *dt, hid_t dxpl_id, void **req);
} H5VL_datatype_class_t;
@@ -355,11 +912,9 @@ typedef struct H5VL_file_class_t {
void *(*create)(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id,
void **req);
void *(*open)(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *file, hid_t dxpl_id, void **req);
} H5VL_file_class_t;
@@ -369,30 +924,28 @@ typedef struct H5VL_group_class_t {
hid_t gcpl_id, hid_t gapl_id, hid_t dxpl_id, void **req);
void *(*open)(void *obj, const H5VL_loc_params_t *loc_params, const char *name, hid_t gapl_id,
hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*specific)(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
- herr_t (*optional)(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*specific)(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
herr_t (*close)(void *grp, hid_t dxpl_id, void **req);
} H5VL_group_class_t;
/* H5L routines */
typedef struct H5VL_link_class_t {
- herr_t (*create)(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+ herr_t (*create)(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
void **req);
herr_t (*move)(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id,
void **req);
- herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args, hid_t dxpl_id,
+ void **req);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
} H5VL_link_class_t;
/* H5O routines */
@@ -402,12 +955,12 @@ typedef struct H5VL_object_class_t {
herr_t (*copy)(void *src_obj, const H5VL_loc_params_t *loc_params1, const char *src_name, void *dst_obj,
const H5VL_loc_params_t *loc_params2, const char *dst_name, hid_t ocpypl_id, hid_t lcpl_id,
hid_t dxpl_id, void **req);
- herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
- herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
- herr_t (*optional)(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ herr_t (*get)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args, hid_t dxpl_id,
+ void **req);
+ herr_t (*specific)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+ herr_t (*optional)(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req);
} H5VL_object_class_t;
/* Asynchronous request 'notify' callback */
@@ -427,6 +980,7 @@ struct H5VL_class_t;
/* Container/connector introspection routines */
typedef struct H5VL_introspect_class_t {
herr_t (*get_conn_cls)(void *obj, H5VL_get_conn_lvl_t lvl, const struct H5VL_class_t **conn_cls);
+ herr_t (*get_cap_flags)(const void *info, unsigned *cap_flags);
herr_t (*opt_query)(void *obj, H5VL_subclass_t cls, int opt_type, uint64_t *flags);
} H5VL_introspect_class_t;
@@ -435,8 +989,8 @@ typedef struct H5VL_request_class_t {
herr_t (*wait)(void *req, uint64_t timeout, H5VL_request_status_t *status);
herr_t (*notify)(void *req, H5VL_request_notify_t cb, void *ctx);
herr_t (*cancel)(void *req, H5VL_request_status_t *status);
- herr_t (*specific)(void *req, H5VL_request_specific_t specific_type, va_list arguments);
- herr_t (*optional)(void *req, H5VL_request_optional_t opt_type, va_list arguments);
+ herr_t (*specific)(void *req, H5VL_request_specific_args_t *args);
+ herr_t (*optional)(void *req, H5VL_optional_args_t *args);
herr_t (*free)(void *req);
} H5VL_request_class_t;
@@ -444,8 +998,8 @@ typedef struct H5VL_request_class_t {
typedef struct H5VL_blob_class_t {
herr_t (*put)(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
herr_t (*get)(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
- herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments);
- herr_t (*optional)(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments);
+ herr_t (*specific)(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
+ herr_t (*optional)(void *obj, void *blob_id, H5VL_optional_args_t *args);
} H5VL_blob_class_t;
/* Object token routines */
@@ -490,8 +1044,8 @@ typedef struct H5VL_class_t {
H5VL_token_class_t token_cls; /**< VOL connector object token class callbacks */
/* Catch-all */
- herr_t (*optional)(void *obj, int op_type, hid_t dxpl_id, void **req,
- va_list arguments); /**< Optional callback */
+ herr_t (*optional)(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req); /**< Optional callback */
} H5VL_class_t;
//! <!-- [H5VL_class_t_snip] -->
@@ -557,6 +1111,53 @@ H5_DLL hid_t H5VLpeek_connector_id_by_name(const char *name);
*/
H5_DLL hid_t H5VLpeek_connector_id_by_value(H5VL_class_value_t value);
+/* User-defined optional operations */
+H5_DLL herr_t H5VLregister_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL herr_t H5VLfind_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL herr_t H5VLunregister_opt_operation(H5VL_subclass_t subcls, const char *op_name);
+H5_DLL herr_t H5VLattr_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t attr_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLdataset_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t dset_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLdatatype_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t type_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLfile_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t file_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLgroup_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t group_id, H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLlink_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t loc_id, const char *name, hid_t lapl_id, H5VL_optional_args_t *args,
+ hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLobject_optional_op(const char *app_file, const char *app_func, unsigned app_line,
+ hid_t loc_id, const char *name, hid_t lapl_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, hid_t es_id);
+H5_DLL herr_t H5VLrequest_optional_op(void *req, hid_t connector_id, H5VL_optional_args_t *args);
+
+/* API Wrappers for "optional_op" routines */
+/* (Must be defined _after_ the function prototype) */
+/* (And must only defined when included in application code, not the library) */
+#ifndef H5VL_MODULE
+/* Inject application compile-time macros into function calls */
+#define H5VLattr_optional_op(...) H5VLattr_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLdataset_optional_op(...) H5VLdataset_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLdatatype_optional_op(...) H5VLdatatype_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLfile_optional_op(...) H5VLfile_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLgroup_optional_op(...) H5VLgroup_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLlink_optional_op(...) H5VLlink_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+#define H5VLobject_optional_op(...) H5VLobject_optional_op(__FILE__, __func__, __LINE__, __VA_ARGS__)
+
+/* Define "wrapper" versions of function calls, to allow compile-time values to
+ * be passed in by language wrapper or library layer on top of HDF5.
+ */
+#define H5VLattr_optional_op_wrap H5_NO_EXPAND(H5VLattr_optional_op)
+#define H5VLdataset_optional_op_wrap H5_NO_EXPAND(H5VLdataset_optional_op)
+#define H5VLdatatype_optional_op_wrap H5_NO_EXPAND(H5VLdatatype_optional_op)
+#define H5VLfile_optional_op_wrap H5_NO_EXPAND(H5VLfile_optional_op)
+#define H5VLgroup_optional_op_wrap H5_NO_EXPAND(H5VLgroup_optional_op)
+#define H5VLlink_optional_op_wrap H5_NO_EXPAND(H5VLlink_optional_op)
+#define H5VLobject_optional_op_wrap H5_NO_EXPAND(H5VLobject_optional_op)
+#endif /* H5VL_MODULE */
+
#ifdef __cplusplus
}
#endif
diff --git a/src/H5VLconnector_passthru.h b/src/H5VLconnector_passthru.h
index 720740f..17029f0 100644
--- a/src/H5VLconnector_passthru.h
+++ b/src/H5VLconnector_passthru.h
@@ -58,8 +58,9 @@ extern "C" {
H5_DLL herr_t H5VLcmp_connector_cls(int *cmp, hid_t connector_id1, hid_t connector_id2);
H5_DLL hid_t H5VLwrap_register(void *obj, H5I_type_t type);
H5_DLL herr_t H5VLretrieve_lib_state(void **state);
+H5_DLL herr_t H5VLstart_lib_state(void);
H5_DLL herr_t H5VLrestore_lib_state(const void *state);
-H5_DLL herr_t H5VLreset_lib_state(void);
+H5_DLL herr_t H5VLfinish_lib_state(void);
H5_DLL herr_t H5VLfree_lib_state(void *state);
/* Pass-through callbacks */
@@ -92,13 +93,12 @@ H5_DLL herr_t H5VLattr_read(void *attr, hid_t connector_id, hid_t dtype_id, void
void **req);
H5_DLL herr_t H5VLattr_write(void *attr, hid_t connector_id, hid_t dtype_id, const void *buf, hid_t dxpl_id,
void **req);
-H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VLattr_get(void *obj, hid_t connector_id, H5VL_attr_get_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLattr_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLattr_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLattr_close(void *attr, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for dataset callbacks */
@@ -111,12 +111,12 @@ H5_DLL herr_t H5VLdataset_read(void *dset, hid_t connector_id, hid_t mem_type_id
hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VLdataset_write(void *dset, hid_t connector_id, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
-H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_dataset_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdataset_get(void *dset, hid_t connector_id, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLdataset_specific(void *obj, hid_t connector_id, H5VL_dataset_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdataset_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLdataset_close(void *dset, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for named datatype callbacks */
@@ -125,24 +125,24 @@ H5_DLL void * H5VLdatatype_commit(void *obj, const H5VL_loc_params_t *loc_params
hid_t dxpl_id, void **req);
H5_DLL void * H5VLdatatype_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_datatype_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLdatatype_get(void *dt, hid_t connector_id, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLdatatype_specific(void *obj, hid_t connector_id, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLdatatype_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLdatatype_close(void *dt, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for file callbacks */
H5_DLL void * H5VLfile_create(const char *name, unsigned flags, hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id,
void **req);
H5_DLL void * H5VLfile_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VLfile_get(void *file, hid_t connector_id, H5VL_file_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLfile_specific(void *obj, hid_t connector_id, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLfile_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLfile_close(void *file, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for group callbacks */
@@ -151,18 +151,17 @@ H5_DLL void * H5VLgroup_create(void *obj, const H5VL_loc_params_t *loc_params, h
void **req);
H5_DLL void * H5VLgroup_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VLgroup_get(void *obj, hid_t connector_id, H5VL_group_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VLgroup_specific(void *obj, hid_t connector_id, H5VL_group_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLgroup_optional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VLgroup_close(void *grp, hid_t connector_id, hid_t dxpl_id, void **req);
/* Public wrappers for link callbacks */
-H5_DLL herr_t H5VLlink_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VLlink_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t connector_id, hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLlink_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
@@ -170,12 +169,11 @@ H5_DLL herr_t H5VLlink_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
const H5VL_loc_params_t *loc_params2, hid_t connector_id, hid_t lcpl_id,
hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLlink_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLlink_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VLlink_optional(void *obj, hid_t connector_id, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLlink_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Public wrappers for object callbacks */
H5_DLL void * H5VLobject_open(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
@@ -184,16 +182,16 @@ H5_DLL herr_t H5VLobject_copy(void *src_obj, const H5VL_loc_params_t *loc_params
void *dst_obj, const H5VL_loc_params_t *loc_params2, const char *dst_name,
hid_t connector_id, hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLobject_get(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VLobject_specific(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VLobject_optional(void *obj, hid_t connector_id, H5VL_object_optional_t opt_type,
- hid_t dxpl_id, void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VLobject_optional(void *obj, const H5VL_loc_params_t *loc_params, hid_t connector_id,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Public wrappers for connector/container introspection callbacks */
H5_DLL herr_t H5VLintrospect_get_conn_cls(void *obj, hid_t connector_id, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VLintrospect_get_cap_flags(const void *info, hid_t connector_id, unsigned *cap_flags);
H5_DLL herr_t H5VLintrospect_opt_query(void *obj, hid_t connector_id, H5VL_subclass_t subcls, int opt_type,
uint64_t *flags);
@@ -202,10 +200,8 @@ H5_DLL herr_t H5VLrequest_wait(void *req, hid_t connector_id, uint64_t timeout,
H5VL_request_status_t *status);
H5_DLL herr_t H5VLrequest_notify(void *req, hid_t connector_id, H5VL_request_notify_t cb, void *ctx);
H5_DLL herr_t H5VLrequest_cancel(void *req, hid_t connector_id, H5VL_request_status_t *status);
-H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_t specific_type,
- va_list arguments);
-H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, H5VL_request_optional_t opt_type,
- va_list arguments);
+H5_DLL herr_t H5VLrequest_specific(void *req, hid_t connector_id, H5VL_request_specific_args_t *args);
+H5_DLL herr_t H5VLrequest_optional(void *req, hid_t connector_id, H5VL_optional_args_t *args);
H5_DLL herr_t H5VLrequest_free(void *req, hid_t connector_id);
/* Public wrappers for blob callbacks */
@@ -214,9 +210,8 @@ H5_DLL herr_t H5VLblob_put(void *obj, hid_t connector_id, const void *buf, size_
H5_DLL herr_t H5VLblob_get(void *obj, hid_t connector_id, const void *blob_id, void *buf, size_t size,
void *ctx);
H5_DLL herr_t H5VLblob_specific(void *obj, hid_t connector_id, void *blob_id,
- H5VL_blob_specific_t specific_type, va_list arguments);
-H5_DLL herr_t H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments);
+ H5VL_blob_specific_args_t *args);
+H5_DLL herr_t H5VLblob_optional(void *obj, hid_t connector_id, void *blob_id, H5VL_optional_args_t *args);
/* Public wrappers for token callbacks */
H5_DLL herr_t H5VLtoken_cmp(void *obj, hid_t connector_id, const H5O_token_t *token1,
@@ -227,8 +222,8 @@ H5_DLL herr_t H5VLtoken_from_str(void *obj, H5I_type_t obj_type, hid_t connector
H5O_token_t *token);
/* Public wrappers for generic 'optional' callback */
-H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, int op_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VLoptional(void *obj, hid_t connector_id, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
#ifdef __cplusplus
}
diff --git a/src/H5VLdyn_ops.c b/src/H5VLdyn_ops.c
new file mode 100644
index 0000000..0992452
--- /dev/null
+++ b/src/H5VLdyn_ops.c
@@ -0,0 +1,334 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*
+ * Purpose: The Virtual Object Layer as described in documentation.
+ * The pupose is to provide an abstraction on how to access the
+ * underlying HDF5 container, whether in a local file with
+ * a specific file format, or remotely on other machines, etc...
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
+
+/***********/
+/* Headers */
+/***********/
+
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5FLprivate.h" /* Free lists */
+#include "H5Iprivate.h" /* IDs */
+#include "H5MMprivate.h" /* Memory management */
+#include "H5SLprivate.h" /* Skip lists */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/* Dynamic operation info */
+typedef struct H5VL_dyn_op_t {
+ char *op_name; /* Name of operation */
+ int op_val; /* Value of operation */
+} H5VL_dyn_op_t;
+
+/********************/
+/* Local Prototypes */
+/********************/
+static void H5VL__release_dyn_op(H5VL_dyn_op_t *dyn_op);
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/* The current optional operation values */
+static int H5VL_opt_vals_g[H5VL_SUBCLS_TOKEN + 1] = {
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_NONE */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_INFO */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_WRAP */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_ATTR */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_DATASET */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_DATATYPE */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_FILE */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_GROUP */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_LINK */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_OBJECT */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_REQUEST */
+ H5VL_RESERVED_NATIVE_OPTIONAL, /* H5VL_SUBCLS_BLOB */
+ H5VL_RESERVED_NATIVE_OPTIONAL /* H5VL_SUBCLS_TOKEN */
+};
+
+/* The current optional operations' info */
+static H5SL_t *H5VL_opt_ops_g[H5VL_SUBCLS_TOKEN + 1] = {
+ NULL, /* H5VL_SUBCLS_NONE */
+ NULL, /* H5VL_SUBCLS_INFO */
+ NULL, /* H5VL_SUBCLS_WRAP */
+ NULL, /* H5VL_SUBCLS_ATTR */
+ NULL, /* H5VL_SUBCLS_DATASET */
+ NULL, /* H5VL_SUBCLS_DATATYPE */
+ NULL, /* H5VL_SUBCLS_FILE */
+ NULL, /* H5VL_SUBCLS_GROUP */
+ NULL, /* H5VL_SUBCLS_LINK */
+ NULL, /* H5VL_SUBCLS_OBJECT */
+ NULL, /* H5VL_SUBCLS_REQUEST */
+ NULL, /* H5VL_SUBCLS_BLOB */
+ NULL /* H5VL_SUBCLS_TOKEN */
+};
+
+/* Declare a free list to manage the H5VL_class_t struct */
+H5FL_DEFINE_STATIC(H5VL_dyn_op_t);
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__release_dyn_op
+ *
+ * Purpose: Release a dynamic operation info node
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+static void
+H5VL__release_dyn_op(H5VL_dyn_op_t *dyn_op)
+{
+ FUNC_ENTER_STATIC_NOERR
+
+ H5MM_xfree(dyn_op->op_name);
+ H5FL_FREE(H5VL_dyn_op_t, dyn_op);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* H5VL__release_dyn_op() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__term_opt_operation_cb
+ *
+ * Purpose: Callback for releasing a dynamically registered operation info
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+static herr_t
+H5VL__term_opt_operation_cb(void *_item, void H5_ATTR_UNUSED *key, void H5_ATTR_UNUSED *op_data)
+{
+ H5VL_dyn_op_t *item = (H5VL_dyn_op_t *)_item; /* Item to release */
+
+ FUNC_ENTER_STATIC_NOERR
+
+ /* Release the dynamically registered operation info */
+ H5VL__release_dyn_op(item);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5VL__term_opt_operation_cb() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__term_opt_operation
+ *
+ * Purpose: Terminate the dynamically registered optional operations,
+ * releasing all operations.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__term_opt_operation(void)
+{
+ size_t subcls; /* Index over the elements of operation array */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Iterate over the VOL subclasses */
+ for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++)
+ if (H5VL_opt_ops_g[subcls])
+ H5SL_destroy(H5VL_opt_ops_g[subcls], H5VL__term_opt_operation_cb, NULL);
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* H5VL__term_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__register_opt_operation
+ *
+ * Purpose: Register a new optional operation for a VOL object subclass.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__register_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val)
+{
+ H5VL_dyn_op_t *new_op; /* Info about new operation */
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(op_val);
+ HDassert(op_name && *op_name);
+
+ /* Check for duplicate operation */
+ if (H5VL_opt_ops_g[subcls]) {
+ if (NULL != H5SL_search(H5VL_opt_ops_g[subcls], op_name))
+ HGOTO_ERROR(H5E_VOL, H5E_EXISTS, FAIL, "operation name already exists")
+ } /* end if */
+ else {
+ /* Create skip list for operation of this subclass */
+ if (NULL == (H5VL_opt_ops_g[subcls] = H5SL_create(H5SL_TYPE_STR, NULL)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, FAIL, "can't create skip list for operations")
+ } /* end else */
+
+ /* Register new operation */
+ if (NULL == (new_op = H5FL_CALLOC(H5VL_dyn_op_t)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate memory for dynamic operation info")
+ if (NULL == (new_op->op_name = H5MM_strdup(op_name)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, FAIL, "can't allocate name for dynamic operation info")
+ new_op->op_val = H5VL_opt_vals_g[subcls]++;
+
+ /* Insert into subclass's skip list */
+ if (H5SL_insert(H5VL_opt_ops_g[subcls], new_op, new_op->op_name) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINSERT, FAIL, "can't insert operation info into skip list")
+
+ /* Return the next operation value to the caller */
+ *op_val = new_op->op_val;
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__register_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__num_opt_operation
+ *
+ * Purpose: Returns the # of currently registered optional operations
+ *
+ * Return: # of registered optional operations / <can't fail>
+ *
+ *---------------------------------------------------------------------------
+ */
+size_t
+H5VL__num_opt_operation(void)
+{
+ size_t subcls; /* Index over the elements of operation array */
+ size_t ret_value = 0; /* Return value */
+
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Iterate over the VOL subclasses */
+ for (subcls = 0; subcls < NELMTS(H5VL_opt_vals_g); subcls++)
+ if (H5VL_opt_ops_g[subcls])
+ ret_value += H5SL_count(H5VL_opt_ops_g[subcls]);
+
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__num_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__find_opt_operation
+ *
+ * Purpose: Look up a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__find_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(op_val);
+ HDassert(op_name && *op_name);
+
+ /* Check for dynamic operations in the VOL subclass */
+ if (H5VL_opt_ops_g[subcls]) {
+ H5VL_dyn_op_t *dyn_op; /* Info about operation */
+
+ /* Search for dynamic operation with correct name */
+ if (NULL == (dyn_op = H5SL_search(H5VL_opt_ops_g[subcls], op_name)))
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+ /* Set operation value for user */
+ *op_val = dyn_op->op_val;
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__find_opt_operation() */
+
+/*---------------------------------------------------------------------------
+ * Function: H5VL__unregister_opt_operation
+ *
+ * Purpose: Unregister a optional operation for a VOL object subclass, by name.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__unregister_opt_operation(H5VL_subclass_t subcls, const char *op_name)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_PACKAGE
+
+ /* Sanity checks */
+ HDassert(op_name && *op_name);
+
+ /* Check for dynamic operations in the VOL subclass */
+ if (H5VL_opt_ops_g[subcls]) {
+ H5VL_dyn_op_t *dyn_op; /* Info about operation */
+
+ /* Search for dynamic operation with correct name */
+ if (NULL == (dyn_op = H5SL_remove(H5VL_opt_ops_g[subcls], op_name)))
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+ /* Release the info for the operation */
+ H5VL__release_dyn_op(dyn_op);
+
+ /* Close the skip list, if no more operations in it */
+ if (0 == H5SL_count(H5VL_opt_ops_g[subcls])) {
+ if (H5SL_close(H5VL_opt_ops_g[subcls]) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCLOSEOBJ, FAIL, "can't close dyn op skip list")
+ H5VL_opt_ops_g[subcls] = NULL;
+ } /* end if */
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_NOTFOUND, FAIL, "operation name isn't registered")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* H5VL__unregister_opt_operation() */
diff --git a/src/H5VLint.c b/src/H5VLint.c
index 500e075..70c8112 100644
--- a/src/H5VLint.c
+++ b/src/H5VLint.c
@@ -88,7 +88,6 @@ typedef struct {
/********************/
static herr_t H5VL__free_cls(H5VL_class_t *cls, void **request);
static int H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data);
-static herr_t H5VL__set_def_conn(void);
static void * H5VL__wrap_obj(void *obj, H5I_type_t obj_type);
static H5VL_object_t *H5VL__new_vol_obj(H5I_type_t type, void *object, H5VL_t *vol_connector,
hbool_t wrap_obj);
@@ -194,6 +193,10 @@ H5VL_init_phase2(void)
if (H5M_init() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize map interface")
+ /* Sanity check default VOL connector */
+ HDassert(H5VL_def_conn_s.connector_id == (-1));
+ HDassert(H5VL_def_conn_s.connector_info == NULL);
+
/* Set up the default VOL connector in the default FAPL */
if (H5VL__set_def_conn() < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "unable to set default VOL connector")
@@ -261,15 +264,22 @@ H5VL_term_package(void)
n++;
} /* end if */
else {
- /* Destroy the VOL connector ID group */
- n += (H5I_dec_type_ref(H5I_VOL) > 0);
-
- /* Mark interface as closed */
- if (0 == n)
- H5_PKG_INIT_VAR = FALSE;
- } /* end else */
- } /* end else */
- } /* end if */
+ if (H5VL__num_opt_operation() > 0) {
+ /* Unregister all dynamically registered optional operations */
+ (void)H5VL__term_opt_operation();
+ n++;
+ } /* end if */
+ else {
+ /* Destroy the VOL connector ID group */
+ n += (H5I_dec_type_ref(H5I_VOL) > 0);
+
+ /* Mark interface as closed */
+ if (0 == n)
+ H5_PKG_INIT_VAR = FALSE;
+ } /* end else */
+ } /* end else */
+ } /* end else */
+ } /* end if */
FUNC_LEAVE_NOAPI(n)
} /* end H5VL_term_package() */
@@ -365,7 +375,7 @@ H5VL__get_connector_cb(void *obj, hid_t id, void *_op_data)
*
*-------------------------------------------------------------------------
*/
-static herr_t
+herr_t
H5VL__set_def_conn(void)
{
H5P_genplist_t *def_fapl; /* Default file access property list */
@@ -376,11 +386,16 @@ H5VL__set_def_conn(void)
void * vol_info = NULL; /* VOL connector info */
herr_t ret_value = SUCCEED; /* Return value */
- FUNC_ENTER_STATIC
+ FUNC_ENTER_PACKAGE
- /* Sanity check */
- HDassert(H5VL_def_conn_s.connector_id == (-1));
- HDassert(H5VL_def_conn_s.connector_info == NULL);
+ /* Reset default VOL connector, if it's set already */
+ /* (Can happen during testing -QAK) */
+ if (H5VL_def_conn_s.connector_id > 0) {
+ /* Release the default VOL connector */
+ (void)H5VL_conn_free(&H5VL_def_conn_s);
+ H5VL_def_conn_s.connector_id = -1;
+ H5VL_def_conn_s.connector_info = NULL;
+ } /* end if */
/* Check for environment variable set */
env_var = HDgetenv("HDF5_VOL_CONNECTOR");
@@ -760,51 +775,47 @@ done:
} /* end H5VL_register_using_existing_id() */
/*-------------------------------------------------------------------------
- * Function: H5VL_register_using_vol_id
+ * Function: H5VL_new_connector
*
- * Purpose: Utility function to create a user ID for an object created
- * or opened through the VOL. Uses the VOL connector's ID to
- * get the connector information instead of it being passed in.
+ * Purpose: Utility function to create a connector for a connector ID.
*
- * Return: Success: A valid HDF5 ID
- * Failure: H5I_INVALID_HID
+ * Return: Success: Pointer to a new connector object
+ * Failure: NULL
*
*-------------------------------------------------------------------------
*/
-hid_t
-H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref)
+H5VL_t *
+H5VL_new_connector(hid_t connector_id)
{
- H5VL_class_t *cls = NULL; /* VOL connector class */
- H5VL_t * connector = NULL; /* VOL connector struct */
- hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
- hid_t ret_value = H5I_INVALID_HID; /* Return value */
+ H5VL_class_t *cls = NULL; /* VOL connector class */
+ H5VL_t * connector = NULL; /* New VOL connector struct */
+ hbool_t conn_id_incr = FALSE; /* Whether the VOL connector ID has been incremented */
+ H5VL_t * ret_value = NULL; /* Return value */
- FUNC_ENTER_NOAPI(FAIL)
+ FUNC_ENTER_NOAPI(NULL)
/* Get the VOL class object from the connector's ID */
if (NULL == (cls = (H5VL_class_t *)H5I_object_verify(connector_id, H5I_VOL)))
- HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, H5I_INVALID_HID, "not a VOL connector ID")
+ HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, NULL, "not a VOL connector ID")
/* Setup VOL info struct */
if (NULL == (connector = H5FL_CALLOC(H5VL_t)))
- HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, H5I_INVALID_HID, "can't allocate VOL info struct")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTALLOC, NULL, "can't allocate VOL connector struct")
connector->cls = cls;
connector->id = connector_id;
if (H5I_inc_ref(connector->id, FALSE) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTINC, H5I_INVALID_HID, "unable to increment ref count on VOL connector")
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINC, NULL, "unable to increment ref count on VOL connector")
conn_id_incr = TRUE;
- /* Get an ID for the VOL object */
- if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+ /* Set return value */
+ ret_value = connector;
done:
/* Clean up on error */
- if (ret_value < 0) {
+ if (NULL == ret_value) {
/* Decrement VOL connector ID ref count on error */
if (conn_id_incr && H5I_dec_ref(connector_id) < 0)
- HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID,
- "unable to decrement ref count on VOL connector")
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, NULL, "unable to decrement ref count on VOL connector")
/* Free VOL connector struct */
if (NULL != connector)
@@ -812,6 +823,45 @@ done:
} /* end if */
FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_new_connector() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_register_using_vol_id
+ *
+ * Purpose: Utility function to create a user ID for an object created
+ * or opened through the VOL. Uses the VOL connector's ID to
+ * get the connector information instead of it being passed in.
+ *
+ * Return: Success: A valid HDF5 ID
+ * Failure: H5I_INVALID_HID
+ *
+ *-------------------------------------------------------------------------
+ */
+hid_t
+H5VL_register_using_vol_id(H5I_type_t type, void *obj, hid_t connector_id, hbool_t app_ref)
+{
+ H5VL_t *connector = NULL; /* VOL connector struct */
+ hid_t ret_value = H5I_INVALID_HID; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Create new VOL connector object, using the connector ID */
+ if (NULL == (connector = H5VL_new_connector(connector_id)))
+ HGOTO_ERROR(H5E_VOL, H5E_CANTCREATE, H5I_INVALID_HID, "can't create VOL connector object")
+
+ /* Get an ID for the VOL object */
+ if ((ret_value = H5VL_register(type, obj, connector, app_ref)) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTREGISTER, H5I_INVALID_HID, "unable to register object handle")
+
+done:
+ /* Clean up on error */
+ if (H5I_INVALID_HID == ret_value)
+ /* Release newly created connector */
+ if (connector && H5VL_conn_dec_rc(connector) < 0)
+ HDONE_ERROR(H5E_VOL, H5E_CANTDEC, H5I_INVALID_HID,
+ "unable to decrement ref count on VOL connector")
+
+ FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_register_using_vol_id() */
/*-------------------------------------------------------------------------
@@ -1125,15 +1175,20 @@ H5VL_file_is_same(const H5VL_object_t *vol_obj1, const H5VL_object_t *vol_obj2,
if (cmp_value)
*same_file = FALSE;
else {
- void *obj2; /* Terminal object for second file */
+ void * obj2; /* Terminal object for second file */
+ H5VL_file_specific_args_t vol_cb_args; /* Arguments to VOL callback */
/* Get unwrapped (terminal) object for vol_obj2 */
if (NULL == (obj2 = H5VL_object_data(vol_obj2)))
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't get unwrapped object")
- /* Make callback */
- if (H5VL_file_specific(vol_obj1, H5VL_FILE_IS_EQUAL, H5P_DATASET_XFER_DEFAULT, NULL, obj2,
- same_file) < 0)
+ /* Set up VOL callback arguments */
+ vol_cb_args.op_type = H5VL_FILE_IS_EQUAL;
+ vol_cb_args.args.is_equal.obj2 = obj2;
+ vol_cb_args.args.is_equal.same_file = same_file;
+
+ /* Make 'are files equal' callback */
+ if (H5VL_file_specific(vol_obj1, &vol_cb_args, H5P_DATASET_XFER_DEFAULT, NULL) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTOPERATE, FAIL, "file specific failed")
} /* end else */
@@ -2047,6 +2102,36 @@ done:
} /* end H5VL_retrieve_lib_state() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_start_lib_state
+ *
+ * Purpose: Opens a new internal state for the HDF5 library.
+ *
+ * Note: Currently just pushes a new API context state, but could be
+ * expanded in the future.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Friday, February 5, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_start_lib_state(void)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Push a new API context on the stack */
+ if (H5CX_push() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_start_lib_state() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_restore_lib_state
*
* Purpose: Restore the state of the library.
@@ -2071,10 +2156,6 @@ H5VL_restore_lib_state(const void *state)
/* Sanity checks */
HDassert(state);
- /* Push a new API context on the stack */
- if (H5CX_push() < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't push API context")
-
/* Restore the API context state */
if (H5CX_restore_state((const H5CX_state_t *)state) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set API context state")
@@ -2084,16 +2165,16 @@ done:
} /* end H5VL_restore_lib_state() */
/*-------------------------------------------------------------------------
- * Function: H5VL_reset_lib_state
+ * Function: H5VL_finish_lib_state
*
- * Purpose: Reset the state of the library, undoing affects of
- * H5VL_restore_lib_state.
+ * Purpose: Closes the state of the library, undoing affects of
+ * H5VL_start_lib_state.
*
* Note: Currently just resets the API context state, but could be
* expanded in the future.
*
* Note: This routine must be called as a "pair" with
- * H5VL_restore_lib_state. It can be called before / after /
+ * H5VL_start_lib_state. It can be called before / after /
* independently of H5VL_free_lib_state.
*
* Return: SUCCEED / FAIL
@@ -2104,7 +2185,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_reset_lib_state(void)
+H5VL_finish_lib_state(void)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2116,7 +2197,7 @@ H5VL_reset_lib_state(void)
done:
FUNC_LEAVE_NOAPI(ret_value)
-} /* end H5VL_reset_lib_state() */
+} /* end H5VL_finish_lib_state() */
/*-------------------------------------------------------------------------
* Function: H5VL_free_lib_state
@@ -2484,6 +2565,33 @@ done:
} /* end H5VL_check_plugin_load() */
/*-------------------------------------------------------------------------
+ * Function: H5VL__is_default_conn
+ *
+ * Purpose: Check if the default connector will be used for a container.
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+void
+H5VL__is_default_conn(hid_t fapl_id, hid_t connector_id, hbool_t *is_default)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity checks */
+ HDassert(is_default);
+
+ /* Determine if the default VOL connector will be used, based on non-default
+ * values in the FAPL, connector ID, or the HDF5_VOL_CONNECTOR environment
+ * variable being set.
+ */
+ *is_default = (H5VL_def_conn_s.connector_id == H5_DEFAULT_VOL) &&
+ ((H5P_FILE_ACCESS_DEFAULT == fapl_id) || connector_id == H5_DEFAULT_VOL);
+
+ FUNC_LEAVE_NOAPI_VOID
+} /* end H5VL__is_default_conn() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_setup_args
*
* Purpose: Set up arguments to access an object
@@ -2506,7 +2614,7 @@ H5VL_setup_args(hid_t loc_id, H5I_type_t id_type, H5VL_object_t **vol_obj)
if (NULL == (*vol_obj = (H5VL_object_t *)H5I_object_verify(loc_id, id_type)))
HGOTO_ERROR(H5E_VOL, H5E_BADTYPE, FAIL, "not the correct type of ID")
- /* Set up collective metadata (if appropriate */
+ /* Set up collective metadata (if appropriate) */
if (H5CX_set_loc(loc_id) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set collective metadata read")
@@ -2631,8 +2739,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libclass, hbool_t is_collective,
- hid_t acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+H5VL_setup_name_args(hid_t loc_id, const char *name, hbool_t is_collective, hid_t lapl_id,
+ H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2649,7 +2757,7 @@ H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libcl
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "name parameter cannot be an empty string")
/* Verify access property list and set up collective metadata if appropriate */
- if (H5CX_set_apl(&acspl_id, libclass, loc_id, is_collective) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
@@ -2659,7 +2767,7 @@ H5VL_setup_name_args(hid_t loc_id, const char *name, const H5P_libclass_t *libcl
/* Set up location parameters */
loc_params->type = H5VL_OBJECT_BY_NAME;
loc_params->loc_data.loc_by_name.name = name;
- loc_params->loc_data.loc_by_name.lapl_id = acspl_id;
+ loc_params->loc_data.loc_by_name.lapl_id = lapl_id;
loc_params->obj_type = H5I_get_type(loc_id);
done:
@@ -2677,8 +2785,8 @@ done:
*/
herr_t
H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter_order_t order, hsize_t n,
- const H5P_libclass_t *libclass, hbool_t is_collective, hid_t acspl_id,
- H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params)
+ hbool_t is_collective, hid_t lapl_id, H5VL_object_t **vol_obj,
+ H5VL_loc_params_t *loc_params)
{
herr_t ret_value = SUCCEED; /* Return value */
@@ -2699,7 +2807,7 @@ H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid iteration order specified")
/* Verify access property list and set up collective metadata if appropriate */
- if (H5CX_set_apl(&acspl_id, libclass, loc_id, is_collective) < 0)
+ if (H5CX_set_apl(&lapl_id, H5P_CLS_LACC, loc_id, is_collective) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTSET, FAIL, "can't set access property list info")
/* Get the location object */
@@ -2712,7 +2820,7 @@ H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter
loc_params->loc_data.loc_by_idx.idx_type = idx_type;
loc_params->loc_data.loc_by_idx.order = order;
loc_params->loc_data.loc_by_idx.n = n;
- loc_params->loc_data.loc_by_idx.lapl_id = acspl_id;
+ loc_params->loc_data.loc_by_idx.lapl_id = lapl_id;
loc_params->obj_type = H5I_get_type(loc_id);
done:
@@ -2752,3 +2860,45 @@ H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_
done:
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5VL_setup_token_args() */
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL_get_cap_flags
+ *
+ * Purpose: Query capability flags for connector property.
+ *
+ * Note: VOL connector set with HDF5_VOL_CONNECTOR overrides the
+ * property passed in.
+ *
+ * Return: Success: Non-negative
+ * Failure: Negative
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_get_cap_flags(const H5VL_connector_prop_t *connector_prop, unsigned *cap_flags)
+{
+ herr_t ret_value = SUCCEED; /* Return value */
+
+ FUNC_ENTER_NOAPI(FAIL)
+
+ /* Sanity check */
+ HDassert(connector_prop);
+
+ /* Copy the connector ID & info, if there is one */
+ if (connector_prop->connector_id > 0) {
+ H5VL_class_t *connector; /* Pointer to connector */
+
+ /* Retrieve the connector for the ID */
+ if (NULL == (connector = (H5VL_class_t *)H5I_object(connector_prop->connector_id)))
+ HGOTO_ERROR(H5E_PLIST, H5E_BADTYPE, FAIL, "not a VOL connector ID")
+
+ /* Query the connector's capability flags */
+ if (H5VL_introspect_get_cap_flags(connector_prop->connector_info, connector, cap_flags) < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't query connector's capability flags")
+ } /* end if */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "connector ID not set?")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL_get_cap_flags() */
diff --git a/src/H5VLmodule.h b/src/H5VLmodule.h
index 009c0e5..8fcb961 100644
--- a/src/H5VLmodule.h
+++ b/src/H5VLmodule.h
@@ -27,14 +27,12 @@
#define H5_MY_PKG_ERR H5E_VOL
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5VL H5VL
- * \brief Virtual Object Layer Interface
- * \todo Describe concisely what the functions in this module are about.
+/**\defgroup H5VL H5VL
+ *
+ * \todo Describe the VOL plugin life cycle.
*
* \defgroup ASYNC Asynchronous Functions
* \brief Asynchronous Functions
- * \todo Describe concisely what the functions in this module are about.
*
* \defgroup H5VLDEF Definitions
* \ingroup H5VL
diff --git a/src/H5VLnative.c b/src/H5VLnative.c
index b70d489..18b5b9c 100644
--- a/src/H5VLnative.c
+++ b/src/H5VLnative.c
@@ -47,13 +47,13 @@ static herr_t H5VL__native_term(void);
/* Native VOL connector class struct */
static const H5VL_class_t H5VL_native_cls_g = {
- H5VL_VERSION, /* VOL class struct version */
- H5VL_NATIVE_VALUE, /* value */
- H5VL_NATIVE_NAME, /* name */
- H5VL_NATIVE_VERSION, /* connector version */
- 0, /* capability flags */
- NULL, /* initialize */
- H5VL__native_term, /* terminate */
+ H5VL_VERSION, /* VOL class struct version */
+ H5VL_NATIVE_VALUE, /* value */
+ H5VL_NATIVE_NAME, /* name */
+ H5VL_NATIVE_VERSION, /* connector version */
+ H5VL_CAP_FLAG_NATIVE_FILES, /* capability flags */
+ NULL, /* initialize */
+ H5VL__native_term, /* terminate */
{
/* info_cls */
(size_t)0, /* info size */
@@ -139,8 +139,9 @@ static const H5VL_class_t H5VL_native_cls_g = {
},
{
/* introspect_cls */
- H5VL__native_introspect_get_conn_cls, /* get_conn_cls */
- H5VL__native_introspect_opt_query, /* opt_query */
+ H5VL__native_introspect_get_conn_cls, /* get_conn_cls */
+ H5VL__native_introspect_get_cap_flags, /* get_cap_flags */
+ H5VL__native_introspect_opt_query, /* opt_query */
},
{
/* request_cls */
@@ -244,6 +245,32 @@ H5VL__native_introspect_get_conn_cls(void H5_ATTR_UNUSED *obj, H5VL_get_conn_lvl
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5VL__native_introspect_get_conn_cls() */
+/*---------------------------------------------------------------------------
+ * Function: H5VL__native_introspect_get_cap_flags
+ *
+ * Purpose: Query the capability flags for this connector.
+ *
+ * Note: This routine is in this file so that it can return the field
+ * from the staticly declared class struct.
+ *
+ * Returns: SUCCEED (Can't fail)
+ *
+ *---------------------------------------------------------------------------
+ */
+herr_t
+H5VL__native_introspect_get_cap_flags(const void H5_ATTR_UNUSED *info, unsigned *cap_flags)
+{
+ FUNC_ENTER_PACKAGE_NOERR
+
+ /* Sanity check */
+ HDassert(cap_flags);
+
+ /* Set the flags from the connector's field */
+ *cap_flags = H5VL_native_cls_g.cap_flags;
+
+ FUNC_LEAVE_NOAPI(SUCCEED)
+} /* end H5VL__native_introspect_get_cap_flags() */
+
/*-------------------------------------------------------------------------
* Function: H5VL_native_get_file_addr_len
*
diff --git a/src/H5VLnative.h b/src/H5VLnative.h
index 425d833..00ee930 100644
--- a/src/H5VLnative.h
+++ b/src/H5VLnative.h
@@ -18,6 +18,7 @@
#define H5VLnative_H
/* Public headers needed by this file */
+#include "H5Apublic.h" /* Attributes */
#include "H5VLpublic.h" /* Virtual Object Layer */
/*****************/
@@ -43,24 +44,137 @@
* must be updated.
*/
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Parameters for attribute 'iterate old' operation */
+typedef struct H5VL_native_attr_iterate_old_t {
+ hid_t loc_id;
+ unsigned * attr_num;
+ H5A_operator1_t op;
+ void * op_data;
+} H5VL_native_attr_iterate_old_t;
+
+/* Parameters for native connector's attribute 'optional' operations */
+typedef union H5VL_native_attr_optional_args_t {
+ /* H5VL_NATIVE_ATTR_ITERATE_OLD */
+ H5VL_native_attr_iterate_old_t iterate_old;
+} H5VL_native_attr_optional_args_t;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
/* Values for native VOL connector dataset optional VOL operations */
/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
* routine must be updated.
*/
-#define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */
-#define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */
-#define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */
-#define H5VL_NATIVE_DATASET_GET_NUM_CHUNKS 3 /* H5Dget_num_chunks */
-#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX 4 /* H5Dget_chunk_info */
-#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */
-#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */
-#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */
-#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */
-#define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */
+#define H5VL_NATIVE_DATASET_FORMAT_CONVERT 0 /* H5Dformat_convert (internal) */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE 1 /* H5Dget_chunk_index_type */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE 2 /* H5Dget_chunk_storage_size */
+#define H5VL_NATIVE_DATASET_GET_NUM_CHUNKS 3 /* H5Dget_num_chunks */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX 4 /* H5Dget_chunk_info */
+#define H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD 5 /* H5Dget_chunk_info_by_coord */
+#define H5VL_NATIVE_DATASET_CHUNK_READ 6 /* H5Dchunk_read */
+#define H5VL_NATIVE_DATASET_CHUNK_WRITE 7 /* H5Dchunk_write */
+#define H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE 8 /* H5Dvlen_get_buf_size */
+#define H5VL_NATIVE_DATASET_GET_OFFSET 9 /* H5Dget_offset */
+#define H5VL_NATIVE_DATASET_CHUNK_ITER 10 /* H5Dchunk_iter */
/* NOTE: If values over 1023 are added, the H5VL_RESERVED_NATIVE_OPTIONAL macro
* must be updated.
*/
+/* Parameters for native connector's dataset 'chunk read' operation */
+typedef struct H5VL_native_dataset_chunk_read_t {
+ const hsize_t *offset;
+ uint32_t filters;
+ void * buf;
+} H5VL_native_dataset_chunk_read_t;
+
+/* Parameters for native connector's dataset 'chunk write' operation */
+typedef struct H5VL_native_dataset_chunk_write_t {
+ const hsize_t *offset;
+ uint32_t filters;
+ uint32_t size;
+ const void * buf;
+} H5VL_native_dataset_chunk_write_t;
+
+/* Parameters for native connector's dataset 'get vlen buf size' operation */
+typedef struct H5VL_native_dataset_get_vlen_buf_size_t {
+ hid_t type_id;
+ hid_t space_id;
+ hsize_t *size; /* Size of variable-length data buffer (OUT) */
+} H5VL_native_dataset_get_vlen_buf_size_t;
+
+/* Parameters for native connector's dataset 'get chunk storage size' operation */
+typedef struct H5VL_native_dataset_get_chunk_storage_size_t {
+ const hsize_t *offset; /* Offset of chunk */
+ hsize_t * size; /* Size of chunk (OUT) */
+} H5VL_native_dataset_get_chunk_storage_size_t;
+
+/* Parameters for native connector's dataset 'get num chunks' operation */
+typedef struct H5VL_native_dataset_get_num_chunks_t {
+ hid_t space_id; /* Space selection */
+ hsize_t *nchunks; /* # of chunk for space selection (OUT) */
+} H5VL_native_dataset_get_num_chunks_t;
+
+/* Parameters for native connector's dataset 'get chunk info by idx' operation */
+typedef struct H5VL_native_dataset_get_chunk_info_by_idx_t {
+ hid_t space_id; /* Space selection */
+ hsize_t chk_index; /* Chunk index within space */
+ hsize_t * offset; /* Chunk coordinates (OUT) */
+ unsigned *filter_mask; /* Filter mask for chunk (OUT) */
+ haddr_t * addr; /* Address of chunk in file (OUT) */
+ hsize_t * size; /* Size of chunk in file (OUT) */
+} H5VL_native_dataset_get_chunk_info_by_idx_t;
+
+/* Parameters for native connector's dataset 'get chunk info by coord' operation */
+typedef struct H5VL_native_dataset_get_chunk_info_by_coord_t {
+ const hsize_t *offset; /* Chunk coordinates */
+ unsigned * filter_mask; /* Filter mask for chunk (OUT) */
+ haddr_t * addr; /* Address of chunk in file (OUT) */
+ hsize_t * size; /* Size of chunk in file (OUT) */
+} H5VL_native_dataset_get_chunk_info_by_coord_t;
+
+/* Parameters for native connector's dataset 'optional' operations */
+typedef union H5VL_native_dataset_optional_args_t {
+ /* H5VL_NATIVE_DATASET_FORMAT_CONVERT */
+ /* No args */
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE */
+ struct {
+ H5D_chunk_index_t *idx_type; /* Type of chunk index (OUT) */
+ } get_chunk_idx_type;
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE */
+ H5VL_native_dataset_get_chunk_storage_size_t get_chunk_storage_size;
+
+ /* H5VL_NATIVE_DATASET_GET_NUM_CHUNKS */
+ H5VL_native_dataset_get_num_chunks_t get_num_chunks;
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX */
+ H5VL_native_dataset_get_chunk_info_by_idx_t get_chunk_info_by_idx;
+
+ /* H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD */
+ H5VL_native_dataset_get_chunk_info_by_coord_t get_chunk_info_by_coord;
+
+ /* H5VL_NATIVE_DATASET_CHUNK_READ */
+ H5VL_native_dataset_chunk_read_t chunk_read;
+
+ /* H5VL_NATIVE_DATASET_CHUNK_WRITE */
+ H5VL_native_dataset_chunk_write_t chunk_write;
+
+ /* H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE */
+ H5VL_native_dataset_get_vlen_buf_size_t get_vlen_buf_size;
+
+ /* H5VL_NATIVE_DATASET_GET_OFFSET */
+ struct {
+ haddr_t *offset; /* Contiguous dataset's offset in the file (OUT) */
+ } get_offset;
+
+ /* H5VL_NATIVE_DATASET_CHUNK_ITER */
+ struct {
+ H5D_chunk_iter_op_t op; /* Chunk iteration callback */
+ void * op_data; /* Context to pass to iteration callback */
+ } chunk_iter;
+
+} H5VL_native_dataset_optional_args_t;
+
/* Values for native VOL connector file optional VOL operations */
/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
* routine must be updated.
@@ -103,6 +217,194 @@
* must be updated.
*/
+/* Parameters for native connector's file 'get file image' operation */
+typedef struct H5VL_native_file_get_file_image_t {
+ size_t buf_size; /* Size of file image buffer */
+ void * buf; /* Buffer for file image (OUT) */
+ size_t *image_len; /* Size of file image (OUT) */
+} H5VL_native_file_get_file_image_t;
+
+/* Parameters for native connector's file 'get free sections' operation */
+typedef struct H5VL_native_file_get_free_sections_t {
+ H5F_mem_t type; /* Type of file memory to query */
+ H5F_sect_info_t *sect_info; /* Array of sections (OUT) */
+ size_t nsects; /* Size of section array */
+ size_t * sect_count; /* Actual # of sections of type (OUT) */
+} H5VL_native_file_get_free_sections_t;
+
+/* Parameters for native connector's file 'get freespace' operation */
+typedef struct H5VL_native_file_get_freespace_t {
+ hsize_t *size; /* Size of free space (OUT) */
+} H5VL_native_file_get_freespace_t;
+
+/* Parameters for native connector's file 'get info' operation */
+typedef struct H5VL_native_file_get_info_t {
+ H5I_type_t type; /* Type of object */
+ H5F_info2_t *finfo; /* Pointer to file info (OUT) */
+} H5VL_native_file_get_info_t;
+
+/* Parameters for native connector's file 'get metadata cache size' operation */
+typedef struct H5VL_native_file_get_mdc_size_t {
+ size_t * max_size; /* Maximum amount of cached data (OUT) */
+ size_t * min_clean_size; /* Minimum amount of cached data to keep clean (OUT) */
+ size_t * cur_size; /* Current amount of cached data (OUT) */
+ uint32_t *cur_num_entries; /* Current # of cached entries (OUT) */
+} H5VL_native_file_get_mdc_size_t;
+
+/* Parameters for native connector's file 'get VFD handle' operation */
+typedef struct H5VL_native_file_get_vfd_handle_t {
+ hid_t fapl_id;
+ void **file_handle; /* File handle from VFD (OUT) */
+} H5VL_native_file_get_vfd_handle_t;
+
+/* Parameters for native connector's file 'get MDC logging status' operation */
+typedef struct H5VL_native_file_get_mdc_logging_status_t {
+ hbool_t *is_enabled; /* Whether logging is enabled (OUT) */
+ hbool_t *is_currently_logging; /* Whether currently logging (OUT) */
+} H5VL_native_file_get_mdc_logging_status_t;
+
+/* Parameters for native connector's file 'get page buffering stats' operation */
+typedef struct H5VL_native_file_get_page_buffering_stats_t {
+ unsigned *accesses; /* Metadata/raw data page access counts (OUT) */
+ unsigned *hits; /* Metadata/raw data page hit counts (OUT) */
+ unsigned *misses; /* Metadata/raw data page miss counts (OUT) */
+ unsigned *evictions; /* Metadata/raw data page eviction counts (OUT) */
+ unsigned *bypasses; /* Metadata/raw data page bypass counts (OUT) */
+} H5VL_native_file_get_page_buffering_stats_t;
+
+/* Parameters for native connector's file 'get MDC image info' operation */
+typedef struct H5VL_native_file_get_mdc_image_info_t {
+ haddr_t *addr; /* Address of image (OUT) */
+ hsize_t *len; /* Length of image (OUT) */
+} H5VL_native_file_get_mdc_image_info_t;
+
+/* Parameters for native connector's file 'set libver bounds' operation */
+typedef struct H5VL_native_file_set_libver_bounds_t {
+ H5F_libver_t low; /* Lowest version possible */
+ H5F_libver_t high; /* Highest version possible */
+} H5VL_native_file_set_libver_bounds_t;
+
+/* Parameters for native connector's file 'optional' operations */
+typedef union H5VL_native_file_optional_args_t {
+ /* H5VL_NATIVE_FILE_CLEAR_ELINK_CACHE */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_GET_FILE_IMAGE */
+ H5VL_native_file_get_file_image_t get_file_image;
+
+ /* H5VL_NATIVE_FILE_GET_FREE_SECTIONS */
+ H5VL_native_file_get_free_sections_t get_free_sections;
+
+ /* H5VL_NATIVE_FILE_GET_FREE_SPACE */
+ H5VL_native_file_get_freespace_t get_freespace;
+
+ /* H5VL_NATIVE_FILE_GET_INFO */
+ H5VL_native_file_get_info_t get_info;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_CONF */
+ struct {
+ H5AC_cache_config_t *config; /* Pointer to MDC config (OUT) */
+ } get_mdc_config;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_HR */
+ struct {
+ double *hit_rate; /* Metadata cache hit rate (OUT) */
+ } get_mdc_hit_rate;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_SIZE */
+ H5VL_native_file_get_mdc_size_t get_mdc_size;
+
+ /* H5VL_NATIVE_FILE_GET_SIZE */
+ struct {
+ hsize_t *size; /* Size of file (OUT) */
+ } get_size;
+
+ /* H5VL_NATIVE_FILE_GET_VFD_HANDLE */
+ H5VL_native_file_get_vfd_handle_t get_vfd_handle;
+
+ /* H5VL_NATIVE_FILE_RESET_MDC_HIT_RATE */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_SET_MDC_CONFIG */
+ struct {
+ const H5AC_cache_config_t *config; /* Pointer to new MDC config */
+ } set_mdc_config;
+
+ /* H5VL_NATIVE_FILE_GET_METADATA_READ_RETRY_INFO */
+ struct {
+ H5F_retry_info_t *info; /* Pointer to metadata read retry info (OUT) */
+ } get_metadata_read_retry_info;
+
+ /* H5VL_NATIVE_FILE_START_SWMR_WRITE */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_START_MDC_LOGGING */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_STOP_MDC_LOGGING */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_GET_MDC_LOGGING_STATUS */
+ H5VL_native_file_get_mdc_logging_status_t get_mdc_logging_status;
+
+ /* H5VL_NATIVE_FILE_FORMAT_CONVERT */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_RESET_PAGE_BUFFERING_STATS */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_GET_PAGE_BUFFERING_STATS */
+ H5VL_native_file_get_page_buffering_stats_t get_page_buffering_stats;
+
+ /* H5VL_NATIVE_FILE_GET_MDC_IMAGE_INFO */
+ H5VL_native_file_get_mdc_image_info_t get_mdc_image_info;
+
+ /* H5VL_NATIVE_FILE_GET_EOA */
+ struct {
+ haddr_t *eoa; /* End of allocated file address space (OUT) */
+ } get_eoa;
+
+ /* H5VL_NATIVE_FILE_INCR_FILESIZE */
+ struct {
+ hsize_t increment; /* Amount to increment file size */
+ } increment_filesize;
+
+ /* H5VL_NATIVE_FILE_SET_LIBVER_BOUNDS */
+ H5VL_native_file_set_libver_bounds_t set_libver_bounds;
+
+ /* H5VL_NATIVE_FILE_GET_MIN_DSET_OHDR_FLAG */
+ struct {
+ hbool_t *minimize; /* Flag whether dataset object headers are minimal (OUT) */
+ } get_min_dset_ohdr_flag;
+
+ /* H5VL_NATIVE_FILE_SET_MIN_DSET_OHDR_FLAG */
+ struct {
+ hbool_t minimize; /* Flag whether dataset object headers should be minimal */
+ } set_min_dset_ohdr_flag;
+
+#ifdef H5_HAVE_PARALLEL
+ /* H5VL_NATIVE_FILE_GET_MPI_ATOMICITY */
+ struct {
+ hbool_t *flag; /* Flag whether MPI atomicity is set for files (OUT) */
+ } get_mpi_atomicity;
+
+ /* H5VL_NATIVE_FILE_SET_MPI_ATOMICITY */
+ struct {
+ hbool_t flag; /* Flag whether to set MPI atomicity for files */
+ } set_mpi_atomicity;
+#endif /* H5_HAVE_PARALLEL */
+
+ /* H5VL_NATIVE_FILE_POST_OPEN */
+ /* No args */
+
+ /* H5VL_NATIVE_FILE_VFD_SWMR_DISABLE_EOT */
+
+ /* H5VL_NATIVE_FILE_VFD_SWMR_ENABLE_EOT */
+
+ /* H5VL_NATIVE_FILE_VFD_SWMR_END_TICK */
+
+} H5VL_native_file_optional_args_t;
+
/* Values for native VOL connector group optional VOL operations */
/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
* routine must be updated.
@@ -115,6 +417,33 @@
* must be updated.
*/
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+/* Parameters for group 'iterate old' operation */
+typedef struct H5VL_native_group_iterate_old_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for iteration */
+ hsize_t idx; /* Index of link to begin iteration at */
+ hsize_t * last_obj; /* Index of last link looked at (OUT) */
+ H5G_iterate_t op; /* Group (link) operator callback */
+ void * op_data; /* Context to pass to iterator callback */
+} H5VL_native_group_iterate_old_t;
+
+/* Parameters for group 'get objinfo' operation */
+typedef struct H5VL_native_group_get_objinfo_t {
+ H5VL_loc_params_t loc_params; /* Location parameters for iteration */
+ hbool_t follow_link; /* Whether to follow links for query */
+ H5G_stat_t * statbuf; /* Pointer to object info struct (OUT) */
+} H5VL_native_group_get_objinfo_t;
+
+/* Parameters for native connector's group 'optional' operations */
+typedef union H5VL_native_group_optional_args_t {
+ /* H5VL_NATIVE_GROUP_ITERATE_OLD */
+ H5VL_native_group_iterate_old_t iterate_old;
+
+ /* H5VL_NATIVE_GROUP_GET_OBJINFO */
+ H5VL_native_group_get_objinfo_t get_objinfo;
+} H5VL_native_group_optional_args_t;
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+
/* Values for native VOL connector object optional VOL operations */
/* NOTE: If new values are added here, the H5VL__native_introspect_opt_query
* routine must be updated.
@@ -129,6 +458,44 @@
* must be updated.
*/
+/* Parameters for native connector's object 'get comment' operation */
+typedef struct H5VL_native_object_get_comment_t {
+ size_t buf_size; /* Size of comment buffer */
+ void * buf; /* Buffer for comment (OUT) */
+ size_t *comment_len; /* Actual size of comment (OUT) */
+} H5VL_native_object_get_comment_t;
+
+/* Parameters for object 'get native info' operation */
+typedef struct H5VL_native_object_get_native_info_t {
+ unsigned fields; /* Fields to retrieve */
+ H5O_native_info_t *ninfo; /* Native info (OUT) */
+} H5VL_native_object_get_native_info_t;
+
+/* Parameters for native connector's object 'optional' operations */
+typedef union H5VL_native_object_optional_args_t {
+ /* H5VL_NATIVE_OBJECT_GET_COMMENT */
+ H5VL_native_object_get_comment_t get_comment;
+
+ /* H5VL_NATIVE_OBJECT_SET_COMMENT */
+ struct {
+ const char *comment; /* Comment string to set for the object (IN) */
+ } set_comment;
+
+ /* H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES */
+ /* No args */
+
+ /* H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES */
+ /* No args */
+
+ /* H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED */
+ struct {
+ hbool_t *flag; /* Flag whether metadata cache flushes are disabled for this object (OUT) */
+ } are_mdc_flushes_disabled;
+
+ /* H5VL_NATIVE_OBJECT_GET_NATIVE_INFO */
+ H5VL_native_object_get_native_info_t get_native_info;
+} H5VL_native_object_optional_args_t;
+
/*******************/
/* Public Typedefs */
/*******************/
diff --git a/src/H5VLnative_attr.c b/src/H5VLnative_attr.c
index f5e5f29..834ae40 100644
--- a/src/H5VLnative_attr.c
+++ b/src/H5VLnative_attr.c
@@ -245,40 +245,37 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_attr_get(void *obj, H5VL_attr_get_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 (get_type) {
+ switch (args->op_type) {
/* H5Aget_space */
case H5VL_ATTR_GET_SPACE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- if ((*ret_id = H5A_get_space(attr)) < 0)
+ if ((args->args.get_space.space_id = H5A_get_space(attr)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of attribute")
break;
}
/* H5Aget_type */
case H5VL_ATTR_GET_TYPE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- if ((*ret_id = H5A__get_type(attr)) < 0)
+ if ((args->args.get_type.type_id = H5A__get_type(attr)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of attribute")
break;
}
/* H5Aget_create_plist */
case H5VL_ATTR_GET_ACPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
- H5A_t *attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- if ((*ret_id = H5A__get_create_plist(attr)) < 0)
+ if ((args->args.get_acpl.acpl_id = H5A__get_create_plist(attr)) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for attr")
break;
@@ -286,40 +283,37 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Aget_name */
case H5VL_ATTR_GET_NAME: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- size_t buf_size = HDva_arg(arguments, size_t);
- char * buf = HDva_arg(arguments, char *);
- ssize_t * ret_val = HDva_arg(arguments, ssize_t *);
- H5A_t * attr = NULL;
+ H5VL_attr_get_name_args_t *get_name_args = &args->args.get_name;
- if (H5VL_OBJECT_BY_SELF == loc_params->type) {
- attr = (H5A_t *)obj;
- /* Call private function in turn */
- if (0 > (*ret_val = H5A__get_name(attr, buf_size, buf)))
+ if (H5VL_OBJECT_BY_SELF == get_name_args->loc_params.type) {
+ if (H5A__get_name((H5A_t *)obj, get_name_args->buf_size, get_name_args->buf,
+ get_name_args->attr_name_len) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "can't get attribute name")
}
- else if (H5VL_OBJECT_BY_IDX == loc_params->type) {
+ else if (H5VL_OBJECT_BY_IDX == get_name_args->loc_params.type) {
H5G_loc_t loc;
+ H5A_t * attr;
/* check arguments */
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_name_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Open the attribute on the object header */
- if (NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n)))
+ if (NULL == (attr = H5A__open_by_idx(&loc, get_name_args->loc_params.loc_data.loc_by_idx.name,
+ get_name_args->loc_params.loc_data.loc_by_idx.idx_type,
+ get_name_args->loc_params.loc_data.loc_by_idx.order,
+ get_name_args->loc_params.loc_data.loc_by_idx.n)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the length of the name */
- *ret_val = (ssize_t)HDstrlen(attr->shared->name);
+ *get_name_args->attr_name_len = HDstrlen(attr->shared->name);
/* Copy the name into the user's buffer, if given */
- if (buf) {
- HDstrncpy(buf, attr->shared->name, MIN((size_t)(*ret_val + 1), buf_size));
- if ((size_t)(*ret_val) >= buf_size)
- buf[buf_size - 1] = '\0';
+ if (get_name_args->buf) {
+ HDstrncpy(get_name_args->buf, attr->shared->name,
+ MIN((*get_name_args->attr_name_len + 1), get_name_args->buf_size));
+ if (*get_name_args->attr_name_len >= get_name_args->buf_size)
+ get_name_args->buf[get_name_args->buf_size - 1] = '\0';
} /* end if */
/* Release resources */
@@ -334,52 +328,51 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED
/* H5Aget_info */
case H5VL_ATTR_GET_INFO: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- H5A_info_t * ainfo = HDva_arg(arguments, H5A_info_t *);
- H5A_t * attr = NULL;
+ H5VL_attr_get_info_args_t *get_info_args = &args->args.get_info;
+ H5A_t * attr = NULL;
- if (H5VL_OBJECT_BY_SELF == loc_params->type) {
+ if (H5VL_OBJECT_BY_SELF == get_info_args->loc_params.type) {
attr = (H5A_t *)obj;
- if (H5A__get_info(attr, ainfo) < 0)
+ if (H5A__get_info(attr, get_info_args->ainfo) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get attribute info")
}
- else if (H5VL_OBJECT_BY_NAME == loc_params->type) {
- char * attr_name = HDva_arg(arguments, char *);
+ else if (H5VL_OBJECT_BY_NAME == get_info_args->loc_params.type) {
H5G_loc_t loc;
/* check arguments */
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Open the attribute on the object header */
if (NULL ==
- (attr = H5A__open_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name)))
+ (attr = H5A__open_by_name(&loc, get_info_args->loc_params.loc_data.loc_by_name.name,
+ get_info_args->attr_name)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the attribute information */
- if (H5A__get_info(attr, ainfo) < 0)
+ if (H5A__get_info(attr, get_info_args->ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
/* Release resources */
if (attr && H5A__close(attr) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTFREE, FAIL, "can't close attribute")
}
- else if (H5VL_OBJECT_BY_IDX == loc_params->type) {
+ else if (H5VL_OBJECT_BY_IDX == get_info_args->loc_params.type) {
H5G_loc_t loc;
/* check arguments */
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Open the attribute on the object header */
- if (NULL == (attr = H5A__open_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n)))
+ if (NULL == (attr = H5A__open_by_idx(&loc, get_info_args->loc_params.loc_data.loc_by_idx.name,
+ get_info_args->loc_params.loc_data.loc_by_idx.idx_type,
+ get_info_args->loc_params.loc_data.loc_by_idx.order,
+ get_info_args->loc_params.loc_data.loc_by_idx.n)))
HGOTO_ERROR(H5E_ATTR, H5E_CANTOPENOBJ, FAIL, "can't open attribute")
/* Get the attribute information */
- if (H5A__get_info(attr, ainfo) < 0)
+ if (H5A__get_info(attr, get_info_args->ainfo) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to get attribute info")
/* Release resources */
@@ -393,11 +386,10 @@ H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t H5_ATTR_UNUSED
}
case H5VL_ATTR_GET_STORAGE_SIZE: {
- hsize_t *ret = HDva_arg(arguments, hsize_t *);
- H5A_t * attr = (H5A_t *)obj;
+ H5A_t *attr = (H5A_t *)obj;
- /* Set return value */
- *ret = attr->shared->data_size;
+ /* Set storage size */
+ *args->args.get_storage_size.data_size = attr->shared->data_size;
break;
}
@@ -419,8 +411,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_attr_specific_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -431,48 +423,51 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (specific_type) {
+ switch (args->op_type) {
+ /* H5Adelete/delete_by_name */
case H5VL_ATTR_DELETE: {
- char *attr_name = HDva_arg(arguments, char *);
-
if (H5VL_OBJECT_BY_SELF == loc_params->type) {
- /* H5Adelete */
/* Delete the attribute from the location */
- if (H5O__attr_remove(loc.oloc, attr_name) < 0)
+ if (H5O__attr_remove(loc.oloc, args->args.del.name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
} /* end if */
else if (H5VL_OBJECT_BY_NAME == loc_params->type) {
- /* H5Adelete_by_name */
/* Delete the attribute */
- if (H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, attr_name) < 0)
+ if (H5A__delete_by_name(&loc, loc_params->loc_data.loc_by_name.name, args->args.del.name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
} /* end else-if */
- else if (H5VL_OBJECT_BY_IDX == loc_params->type) {
- /* H5Adelete_by_idx */
+ else
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete location")
+ break;
+ }
+
+ /* H5Adelete_by_idx */
+ case H5VL_ATTR_DELETE_BY_IDX: {
+ H5VL_attr_delete_by_idx_args_t *del_by_idx_args =
+ &args->args.delete_by_idx; /* Arguments to delete_by_idx operation */
+
+ if (H5VL_OBJECT_BY_NAME == loc_params->type) {
/* Delete the attribute from the location */
- if (H5A__delete_by_idx(
- &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n) < 0)
+ if (H5A__delete_by_idx(&loc, loc_params->loc_data.loc_by_name.name, del_by_idx_args->idx_type,
+ del_by_idx_args->order, del_by_idx_args->n) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTDELETE, FAIL, "unable to delete attribute")
- } /* end else-if */
+ } /* end if */
else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute remove parameters")
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown attribute delete_by_idx location")
break;
}
+ /* H5Aexists/exists_by_name */
case H5VL_ATTR_EXISTS: {
- const char *attr_name = HDva_arg(arguments, const char *);
- hbool_t * attr_exists = HDva_arg(arguments, hbool_t *);
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aexists */
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) {
/* Check if the attribute exists */
- if (H5O__attr_exists(loc.oloc, attr_name, attr_exists) < 0)
+ if (H5O__attr_exists(loc.oloc, args->args.exists.name, args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aexists_by_name */
+ } /* end if */
+ else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
/* Check if the attribute exists */
- if (H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, attr_name, attr_exists) <
- 0)
+ if (H5A__exists_by_name(loc, loc_params->loc_data.loc_by_name.name, args->args.exists.name,
+ args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTGET, FAIL, "unable to determine if attribute exists")
} /* end else-if */
else
@@ -480,42 +475,38 @@ H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
break;
}
+ /* H5Aiterate/iterate_by_name */
case H5VL_ATTR_ITER: {
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- hsize_t * idx = HDva_arg(arguments, hsize_t *);
- H5A_operator2_t op = HDva_arg(arguments, H5A_operator2_t);
- void * op_data = HDva_arg(arguments, void *);
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Aiterate2 */
- /* Iterate over attributes */
- if ((ret_value = H5A__iterate(&loc, ".", idx_type, order, idx, op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "error iterating over attributes")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Aiterate_by_name */
- /* Iterate over attributes by name */
- if ((ret_value = H5A__iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- idx, op, op_data)) < 0)
- HGOTO_ERROR(H5E_ATTR, H5E_BADITER, FAIL, "attribute iteration failed");
- } /* end else-if */
+ H5VL_attr_iterate_args_t *iter_args = &args->args.iterate; /* Arguments to iterate operation */
+ static const char * self_name = "."; /* Name for 'self' location */
+ const char * loc_name; /* Location name */
+
+ /* Set correct name, for type of location */
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) /* H5Aiterate2 */
+ loc_name = self_name;
+ else if (loc_params->type == H5VL_OBJECT_BY_NAME) /* H5Aiterate_by_name */
+ loc_name = loc_params->loc_data.loc_by_name.name;
else
- HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown parameters")
+ HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unsupported location type")
+
+ /* Iterate over attributes */
+ if ((ret_value = H5A__iterate(&loc, loc_name, iter_args->idx_type, iter_args->order,
+ iter_args->idx, iter_args->op, iter_args->op_data)) < 0)
+ HERROR(H5E_ATTR, H5E_BADITER, "attribute iteration failed");
break;
}
/* H5Arename/rename_by_name */
case H5VL_ATTR_RENAME: {
- const char *old_name = HDva_arg(arguments, const char *);
- const char *new_name = HDva_arg(arguments, const char *);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Arename */
/* Call attribute rename routine */
- if (H5O__attr_rename(loc.oloc, old_name, new_name) < 0)
+ if (H5O__attr_rename(loc.oloc, args->args.rename.old_name, args->args.rename.new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Arename_by_name */
/* Call attribute rename routine */
- if (H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name, old_name, new_name) < 0)
+ if (H5A__rename_by_name(loc, loc_params->loc_data.loc_by_name.name,
+ args->args.rename.old_name, args->args.rename.new_name) < 0)
HGOTO_ERROR(H5E_ATTR, H5E_CANTRENAME, FAIL, "can't rename attribute")
} /* end else-if */
else
@@ -541,24 +532,24 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_attr_optional_t opt_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
- va_list H5_ATTR_DEPRECATED_USED arguments)
+H5VL__native_attr_optional(void H5_ATTR_UNUSED *obj, H5VL_optional_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
- herr_t ret_value = SUCCEED; /* Return value */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5VL_native_attr_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (opt_type) {
+ switch (args->op_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
case H5VL_NATIVE_ATTR_ITERATE_OLD: {
- hid_t loc_id = HDva_arg(arguments, hid_t);
- unsigned * attr_num = HDva_arg(arguments, unsigned *);
- H5A_operator1_t op = HDva_arg(arguments, H5A_operator1_t);
- void * op_data = HDva_arg(arguments, void *);
+ H5VL_native_attr_iterate_old_t *iter_args = &opt_args->iterate_old;
/* Call the actual iteration routine */
- if ((ret_value = H5A__iterate_old(loc_id, attr_num, op, op_data)) < 0)
+ if ((ret_value = H5A__iterate_old(iter_args->loc_id, iter_args->attr_num, iter_args->op,
+ iter_args->op_data)) < 0)
HERROR(H5E_VOL, H5E_BADITER, "error iterating over attributes");
break;
diff --git a/src/H5VLnative_blob.c b/src/H5VLnative_blob.c
index 170a5bc..1107227 100644
--- a/src/H5VLnative_blob.c
+++ b/src/H5VLnative_blob.c
@@ -145,7 +145,7 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type, va_list arguments)
+H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args)
{
H5F_t *f = (H5F_t *)obj; /* Retrieve file pointer */
herr_t ret_value = SUCCEED; /* Return value */
@@ -156,44 +156,24 @@ H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specif
HDassert(f);
HDassert(blob_id);
- switch (specific_type) {
- case H5VL_BLOB_GETSIZE: {
- const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
- size_t * size = HDva_arg(arguments, size_t *);
- H5HG_t hobjid; /* blob's heap ID */
-
- /* Get heap information */
- H5F_addr_decode(f, &id, &(hobjid.addr));
- UINT32DECODE(id, hobjid.idx);
-
- /* Get heap object's size */
- if (hobjid.addr > 0) {
- if (H5HG_get_obj_size(f, &hobjid, size) < 0)
- HGOTO_ERROR(H5E_VOL, H5E_CANTREMOVE, FAIL, "unable to remove heap object")
- } /* end if */
- else
- *size = 0; /* Return '0' size for 'nil' blob ID */
-
- break;
- }
-
+ switch (args->op_type) {
case H5VL_BLOB_ISNULL: {
- const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
- hbool_t * isnull = HDva_arg(arguments, hbool_t *);
- haddr_t addr; /* Sequence's heap address */
+ const uint8_t *id = (const uint8_t *)blob_id; /* Pointer to the blob ID */
+ haddr_t addr; /* Sequence's heap address */
/* Get the heap address */
H5F_addr_decode(f, &id, &addr);
/* Check if heap address is 'nil' */
- *isnull = (addr == 0 ? TRUE : FALSE);
+ *args->args.is_null.isnull = (addr == 0 ? TRUE : FALSE);
break;
}
case H5VL_BLOB_SETNULL: {
uint8_t *id = (uint8_t *)blob_id; /* Pointer to the blob ID */
- /* Encode the "nil" heap pointer information */
+
+ /* Encode the 'nil' heap pointer information */
H5F_addr_encode(f, &id, (haddr_t)0);
UINT32ENCODE(id, 0);
diff --git a/src/H5VLnative_dataset.c b/src/H5VLnative_dataset.c
index 3a7f105..1375344 100644
--- a/src/H5VLnative_dataset.c
+++ b/src/H5VLnative_dataset.c
@@ -369,31 +369,26 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_dataset_get(void *obj, H5VL_dataset_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5D_t *dset = (H5D_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
+ switch (args->op_type) {
/* H5Dget_space */
case H5VL_DATASET_GET_SPACE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D__get_space(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get space ID of dataset")
+ if ((args->args.get_space.space_id = H5D__get_space(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get space ID of dataset")
break;
}
/* H5Dget_space_status */
case H5VL_DATASET_GET_SPACE_STATUS: {
- H5D_space_status_t *allocation = HDva_arg(arguments, H5D_space_status_t *);
-
- /* Read data space address and return */
- if (H5D__get_space_status(dset, allocation) < 0)
+ if (H5D__get_space_status(dset, args->args.get_space_status.status) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to get space status")
break;
@@ -401,40 +396,31 @@ H5VL__native_dataset_get(void *obj, H5VL_dataset_get_t get_type, hid_t H5_ATTR_U
/* H5Dget_type */
case H5VL_DATASET_GET_TYPE: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D__get_type(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get datatype ID of dataset")
+ if ((args->args.get_type.type_id = H5D__get_type(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get datatype ID of dataset")
break;
}
/* H5Dget_create_plist */
case H5VL_DATASET_GET_DCPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D_get_create_plist(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for dataset")
+ if ((args->args.get_dcpl.dcpl_id = H5D_get_create_plist(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get creation property list for dataset")
break;
}
/* H5Dget_access_plist */
case H5VL_DATASET_GET_DAPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if ((*ret_id = H5D_get_access_plist(dset)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get access property list for dataset")
+ if ((args->args.get_dapl.dapl_id = H5D_get_access_plist(dset)) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get access property list for dataset")
break;
}
/* H5Dget_storage_size */
case H5VL_DATASET_GET_STORAGE_SIZE: {
- hsize_t *ret = HDva_arg(arguments, hsize_t *);
-
- /* Set return value */
- if (H5D__get_storage_size(dset, ret) < 0)
+ if (H5D__get_storage_size(dset, args->args.get_storage_size.storage_size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of dataset's storage")
break;
}
@@ -457,69 +443,38 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5D_t *dset = (H5D_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
- /* H5Dspecific_space */
- case H5VL_DATASET_SET_EXTENT: { /* H5Dset_extent (H5Dextend - deprecated) */
- const hsize_t *size = HDva_arg(arguments, const hsize_t *);
-
- if (H5D__set_extent(dset, size) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "unable to set extent of dataset")
+ switch (args->op_type) {
+ /* H5Dset_extent (H5Dextend - deprecated) */
+ case H5VL_DATASET_SET_EXTENT: {
+ if (H5D__set_extent(dset, args->args.set_extent.size) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTSET, FAIL, "unable to set extent of dataset")
break;
}
- case H5VL_DATASET_FLUSH: { /* H5Dflush */
- hid_t dset_id = HDva_arg(arguments, hid_t);
-
- /* Flush the dataset */
- if (H5D__flush(dset, dset_id) < 0)
+ /* H5Dflush */
+ case H5VL_DATASET_FLUSH: {
+ if (H5D__flush(dset, args->args.flush.dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTFLUSH, FAIL, "unable to flush dataset")
break;
}
- case H5VL_DATASET_REFRESH: { /* H5Drefresh */
- hid_t dset_id = HDva_arg(arguments, hid_t);
-
- /* Refresh the dataset */
- if ((H5D__refresh(dset_id, dset)) < 0)
+ /* H5Drefresh */
+ case H5VL_DATASET_REFRESH: {
+ if (H5D__refresh(dset, args->args.refresh.dset_id) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL, "unable to refresh dataset")
break;
}
- case H5VL_DATASET_WAIT: { /* H5Dwait */
- /* The native VOL connector doesn't support asynchronous
- * operations, so this is a no-op.
- */
- break;
- }
-
- case H5VL_DATASET_CHUNK_ITER: { /* H5Dchunk_iter */
- H5D_chunk_iter_op_t cb = HDva_arg(arguments, H5D_chunk_iter_op_t);
- void * op_data = HDva_arg(arguments, void *);
-
- HDassert(dset->shared);
-
- /* Make sure the dataset is chunked */
- if (H5D_CHUNKED != dset->shared->layout.type) {
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
- }
-
- /* Call private function */
- if (H5D__chunk_iter(dset, cb, op_data) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't iterate over chunks")
-
- break;
- }
-
default:
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "invalid specific operation")
} /* end switch */
@@ -538,11 +493,11 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type, hid_t dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void H5_ATTR_UNUSED **req)
{
- H5D_t *dset = (H5D_t *)obj; /* Dataset */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5D_t * dset = (H5D_t *)obj; /* Dataset */
+ H5VL_native_dataset_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
@@ -552,13 +507,14 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
/* Set DXPL for operation */
H5CX_set_dxpl(dxpl_id);
- switch (optional_type) {
- case H5VL_NATIVE_DATASET_FORMAT_CONVERT: { /* H5Dformat_convert */
+ switch (args->op_type) {
+ /* H5Dformat_convert */
+ case H5VL_NATIVE_DATASET_FORMAT_CONVERT: {
switch (dset->shared->layout.type) {
case H5D_CHUNKED:
/* Convert the chunk indexing type to version 1 B-tree if not */
if (dset->shared->layout.u.chunk.idx_type != H5D_CHUNK_IDX_BTREE)
- if ((H5D__format_convert(dset)) < 0)
+ if (H5D__format_convert(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL,
"unable to downgrade chunk indexing type for dataset")
break;
@@ -567,7 +523,7 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
case H5D_COMPACT:
/* Downgrade the layout version to 3 if greater than 3 */
if (dset->shared->layout.version > H5O_LAYOUT_VERSION_DEFAULT)
- if ((H5D__format_convert(dset)) < 0)
+ if (H5D__format_convert(dset) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTLOAD, FAIL,
"unable to downgrade layout version for dataset")
break;
@@ -587,47 +543,46 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: { /* H5Dget_chunk_index_type */
- H5D_chunk_index_t *idx_type = HDva_arg(arguments, H5D_chunk_index_t *);
-
+ /* H5Dget_chunk_index_type */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INDEX_TYPE: {
/* Make sure the dataset is chunked */
if (H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Get the chunk indexing type */
- *idx_type = dset->shared->layout.u.chunk.idx_type;
+ *opt_args->get_chunk_idx_type.idx_type = dset->shared->layout.u.chunk.idx_type;
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: { /* H5Dget_chunk_storage_size */
- hsize_t *offset = HDva_arg(arguments, hsize_t *);
- hsize_t *chunk_nbytes = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_chunk_storage_size */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_STORAGE_SIZE: {
+ H5VL_native_dataset_get_chunk_storage_size_t *gcss_args = &opt_args->get_chunk_storage_size;
/* Make sure the dataset is chunked */
if (H5D_CHUNKED != dset->shared->layout.type)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_chunk_storage_size(dset, offset, chunk_nbytes) < 0)
+ if (H5D__get_chunk_storage_size(dset, gcss_args->offset, gcss_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get storage size of chunk")
break;
}
- case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: { /* H5Dget_num_chunks */
- const H5S_t *space = NULL;
- hid_t space_id = HDva_arg(arguments, hid_t);
- hsize_t * nchunks = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_num_chunks */
+ case H5VL_NATIVE_DATASET_GET_NUM_CHUNKS: {
+ H5VL_native_dataset_get_num_chunks_t *gnc_args = &opt_args->get_num_chunks;
+ const H5S_t * space = NULL;
HDassert(dset->shared);
HDassert(dset->shared->space);
/* When default dataspace is given, use the dataset's dataspace */
- if (space_id == H5S_ALL)
+ if (gnc_args->space_id == H5S_ALL)
space = dset->shared->space;
else /* otherwise, use the given space ID */
- if (NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (const H5S_t *)H5I_object_verify(gnc_args->space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID")
/* Make sure the dataset is chunked */
@@ -635,29 +590,25 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_num_chunks(dset, space, nchunks) < 0)
+ if (H5D__get_num_chunks(dset, space, gnc_args->nchunks) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get number of chunks")
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: { /* H5Dget_chunk_info */
- const H5S_t *space = NULL;
- hid_t space_id = HDva_arg(arguments, hid_t);
- hsize_t chk_index = HDva_arg(arguments, hsize_t);
- hsize_t * offset = HDva_arg(arguments, hsize_t *);
- unsigned * filter_mask = HDva_arg(arguments, unsigned *);
- haddr_t * addr = HDva_arg(arguments, haddr_t *);
- hsize_t * size = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_chunk_info */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_IDX: {
+ H5VL_native_dataset_get_chunk_info_by_idx_t *gcibi_args = &opt_args->get_chunk_info_by_idx;
+ const H5S_t * space;
HDassert(dset->shared);
HDassert(dset->shared->space);
/* When default dataspace is given, use the dataset's dataspace */
- if (space_id == H5S_ALL)
+ if (gcibi_args->space_id == H5S_ALL)
space = dset->shared->space;
else /* otherwise, use the given space ID */
- if (NULL == (space = (const H5S_t *)H5I_object_verify(space_id, H5I_DATASPACE)))
+ if (NULL == (space = (const H5S_t *)H5I_object_verify(gcibi_args->space_id, H5I_DATASPACE)))
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a valid dataspace ID")
/* Make sure the dataset is chunked */
@@ -665,16 +616,16 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_chunk_info(dset, space, chk_index, offset, filter_mask, addr, size) < 0)
+ if (H5D__get_chunk_info(dset, space, gcibi_args->chk_index, gcibi_args->offset,
+ gcibi_args->filter_mask, gcibi_args->addr, gcibi_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by index")
+
break;
}
- case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: { /* H5Dget_chunk_info_by_coord */
- hsize_t * offset = HDva_arg(arguments, hsize_t *);
- unsigned *filter_mask = HDva_arg(arguments, unsigned *);
- haddr_t * addr = HDva_arg(arguments, haddr_t *);
- hsize_t * size = HDva_arg(arguments, hsize_t *);
+ /* H5Dget_chunk_info_by_coord */
+ case H5VL_NATIVE_DATASET_GET_CHUNK_INFO_BY_COORD: {
+ H5VL_native_dataset_get_chunk_info_by_coord_t *gcibc_args = &opt_args->get_chunk_info_by_coord;
HDassert(dset->shared);
@@ -683,17 +634,17 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
/* Call private function */
- if (H5D__get_chunk_info_by_coord(dset, offset, filter_mask, addr, size) < 0)
+ if (H5D__get_chunk_info_by_coord(dset, gcibc_args->offset, gcibc_args->filter_mask,
+ gcibc_args->addr, gcibc_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get chunk info by its logical coordinates")
break;
}
- case H5VL_NATIVE_DATASET_CHUNK_READ: { /* H5Dread_chunk */
- const hsize_t *offset = HDva_arg(arguments, hsize_t *);
- uint32_t * filters = HDva_arg(arguments, uint32_t *);
- void * buf = HDva_arg(arguments, void *);
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+ /* H5Dread_chunk */
+ case H5VL_NATIVE_DATASET_CHUNK_READ: {
+ H5VL_native_dataset_chunk_read_t *chunk_read_args = &opt_args->chunk_read;
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
/* Check arguments */
if (NULL == dset->oloc.file)
@@ -704,22 +655,21 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
/* Copy the user's offset array so we can be sure it's terminated properly.
* (we don't want to mess with the user's buffer).
*/
- if (H5D__get_offset_copy(dset, offset, offset_copy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+ if (H5D__chunk_get_offset_copy(dset, chunk_read_args->offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array")
/* Read the raw chunk */
- if (H5D__chunk_direct_read(dset, offset_copy, filters, buf) < 0)
+ if (H5D__chunk_direct_read(dset, offset_copy, &chunk_read_args->filters, chunk_read_args->buf) <
+ 0)
HGOTO_ERROR(H5E_DATASET, H5E_READERROR, FAIL, "can't read unprocessed chunk data")
break;
}
- case H5VL_NATIVE_DATASET_CHUNK_WRITE: { /* H5Dwrite_chunk */
- uint32_t filters = HDva_arg(arguments, uint32_t);
- const hsize_t *offset = HDva_arg(arguments, const hsize_t *);
- uint32_t data_size_32 = HDva_arg(arguments, uint32_t);
- const void * buf = HDva_arg(arguments, const void *);
- hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
+ /* H5Dwrite_chunk */
+ case H5VL_NATIVE_DATASET_CHUNK_WRITE: {
+ H5VL_native_dataset_chunk_write_t *chunk_write_args = &opt_args->chunk_write;
+ hsize_t offset_copy[H5O_LAYOUT_NDIMS]; /* Internal copy of chunk offset */
/* Check arguments */
if (NULL == dset->oloc.file)
@@ -730,34 +680,48 @@ H5VL__native_dataset_optional(void *obj, H5VL_dataset_optional_t optional_type,
/* Copy the user's offset array so we can be sure it's terminated properly.
* (we don't want to mess with the user's buffer).
*/
- if (H5D__get_offset_copy(dset, offset, offset_copy) < 0)
- HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "failure to copy offset array")
+ if (H5D__chunk_get_offset_copy(dset, chunk_write_args->offset, offset_copy) < 0)
+ HGOTO_ERROR(H5E_DATASET, H5E_CANTCOPY, FAIL, "failure to copy offset array")
/* Write chunk */
- if (H5D__chunk_direct_write(dset, filters, offset_copy, data_size_32, buf) < 0)
+ if (H5D__chunk_direct_write(dset, chunk_write_args->filters, offset_copy, chunk_write_args->size,
+ chunk_write_args->buf) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_WRITEERROR, FAIL, "can't write unprocessed chunk data")
break;
}
- case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: { /* H5Dvlen_get_buf_size */
- hid_t type_id = HDva_arg(arguments, hid_t);
- hid_t space_id = HDva_arg(arguments, hid_t);
- hsize_t *size = HDva_arg(arguments, hsize_t *);
+ /* H5Dvlen_get_buf_size */
+ case H5VL_NATIVE_DATASET_GET_VLEN_BUF_SIZE: {
+ H5VL_native_dataset_get_vlen_buf_size_t *gvbs_args = &opt_args->get_vlen_buf_size;
- if (H5D__vlen_get_buf_size(dset, type_id, space_id, size) < 0)
+ if (H5D__vlen_get_buf_size(dset, gvbs_args->type_id, gvbs_args->space_id, gvbs_args->size) < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CANTGET, FAIL, "can't get size of vlen buf needed")
break;
}
/* H5Dget_offset */
case H5VL_NATIVE_DATASET_GET_OFFSET: {
- haddr_t *ret = HDva_arg(arguments, haddr_t *);
+ /* Get offset */
+ *opt_args->get_offset.offset = H5D__get_offset(dset);
+
+ break;
+ }
+
+ /* H5Dchunk_iter */
+ case H5VL_NATIVE_DATASET_CHUNK_ITER: {
+ /* Sanity check */
+ HDassert(dset->shared);
+
+ /* Make sure the dataset is chunked */
+ if (H5D_CHUNKED != dset->shared->layout.type)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a chunked dataset")
+
+ /* Call private function */
+ if ((ret_value = H5D__chunk_iter(dset, opt_args->chunk_iter.op, opt_args->chunk_iter.op_data)) <
+ 0)
+ HERROR(H5E_DATASET, H5E_BADITER, "chunk iteration failed");
- /* Set return value */
- *ret = H5D__get_offset(dset);
- if (!H5F_addr_defined(*ret))
- *ret = HADDR_UNDEF;
break;
}
diff --git a/src/H5VLnative_datatype.c b/src/H5VLnative_datatype.c
index 84b13c3..bf6f37c 100644
--- a/src/H5VLnative_datatype.c
+++ b/src/H5VLnative_datatype.c
@@ -175,32 +175,34 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_datatype_get(void *obj, H5VL_datatype_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_datatype_get(void *obj, H5VL_datatype_get_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5T_t *dt = (H5T_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (get_type) {
- case H5VL_DATATYPE_GET_BINARY: {
- ssize_t *nalloc = HDva_arg(arguments, ssize_t *);
- void * buf = HDva_arg(arguments, void *);
- size_t size = HDva_arg(arguments, size_t);
+ switch (args->op_type) {
+ /* H5T_construct_datatype (library private routine) */
+ case H5VL_DATATYPE_GET_BINARY_SIZE: {
+ if (H5T_encode(dt, NULL, args->args.get_binary_size.size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't determine serialized length of datatype")
+
+ break;
+ }
- if (H5T_encode(dt, (unsigned char *)buf, &size) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "can't determine serialized length of datatype")
+ /* H5T_construct_datatype (library private routine) */
+ case H5VL_DATATYPE_GET_BINARY: {
+ if (H5T_encode(dt, args->args.get_binary.buf, &args->args.get_binary.buf_size) < 0)
+ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTSERIALIZE, FAIL, "can't serialize datatype")
- *nalloc = (ssize_t)size;
break;
}
/* H5Tget_create_plist */
case H5VL_DATATYPE_GET_TCPL: {
- hid_t *ret_id = HDva_arg(arguments, hid_t *);
-
- if (H5I_INVALID_HID == (*ret_id = H5T__get_create_plist(dt)))
+ if (H5I_INVALID_HID == (args->args.get_tcpl.tcpl_id = H5T__get_create_plist(dt)))
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTGET, FAIL, "can't get object creation info");
break;
@@ -224,30 +226,26 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5T_t *dt = (H5T_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
+ switch (args->op_type) {
+ /* H5VL_DATATYPE_FLUSH */
case H5VL_DATATYPE_FLUSH: {
- hid_t type_id = HDva_arg(arguments, hid_t);
-
- /* To flush metadata and invoke flush callback if there is */
- if (H5O_flush_common(&dt->oloc, type_id) < 0)
+ if (H5O_flush_common(&dt->oloc, args->args.flush.type_id) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTFLUSH, FAIL, "unable to flush datatype")
break;
}
+ /* H5VL_DATATYPE_REFRESH */
case H5VL_DATATYPE_REFRESH: {
- hid_t type_id = HDva_arg(arguments, hid_t);
-
- /* Call private function to refresh datatype object */
- if ((H5O_refresh_metadata(type_id, dt->oloc)) < 0)
+ if ((H5O_refresh_metadata(&dt->oloc, args->args.refresh.type_id)) < 0)
HGOTO_ERROR(H5E_DATATYPE, H5E_CANTLOAD, FAIL, "unable to refresh datatype")
break;
diff --git a/src/H5VLnative_file.c b/src/H5VLnative_file.c
index 3bcaaba..4653bea 100644
--- a/src/H5VLnative_file.c
+++ b/src/H5VLnative_file.c
@@ -147,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;
@@ -169,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;
@@ -201,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.
@@ -210,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;
@@ -229,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;
}
@@ -315,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
@@ -341,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")
@@ -353,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;
}
@@ -466,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;
@@ -552,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;
}
@@ -605,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;
}
@@ -612,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;
}
@@ -639,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;
}
@@ -664,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;
@@ -698,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;
@@ -717,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;
@@ -729,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 */
@@ -747,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.*/
@@ -768,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;
@@ -776,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;
@@ -788,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 */
@@ -823,31 +719,28 @@ 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;
}
/* H5Fvfd_swmr_disable_end_of_tick() */
case H5VL_NATIVE_FILE_VFD_SWMR_DISABLE_EOT: {
- /* Call package routine */
- if (H5F__vfd_swmr_disable_end_of_tick((H5F_t *)obj) < 0)
+ if (H5F__vfd_swmr_disable_end_of_tick(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't disable EOT for VFD SWMR")
break;
}
/* H5Fvfd_swmr_enable_end_of_tick() */
case H5VL_NATIVE_FILE_VFD_SWMR_ENABLE_EOT: {
- /* Call package routine */
- if (H5F__vfd_swmr_enable_end_of_tick((H5F_t *)obj) < 0)
+ if (H5F__vfd_swmr_enable_end_of_tick(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't enable EOT for VFD SWMR")
break;
}
/* H5Fvfd_swmr_end_tick() */
case H5VL_NATIVE_FILE_VFD_SWMR_END_TICK: {
- /* Call package routine */
- if (H5F__vfd_swmr_end_tick((H5F_t *)obj) < 0)
+ if (H5F__vfd_swmr_end_tick(f) < 0)
HGOTO_ERROR(H5E_FILE, H5E_CANTINIT, FAIL, "can't trigger EOT processing for VFD SWMR")
break;
}
@@ -898,7 +791,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 */
diff --git a/src/H5VLnative_group.c b/src/H5VLnative_group.c
index 53f8459..54f8337 100644
--- a/src/H5VLnative_group.c
+++ b/src/H5VLnative_group.c
@@ -169,55 +169,54 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_group_get(void *obj, H5VL_group_get_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 (get_type) {
+ switch (args->op_type) {
/* H5Gget_create_plist */
case H5VL_GROUP_GET_GCPL: {
- hid_t *new_gcpl_id = HDva_arg(arguments, hid_t *);
- H5G_t *grp = (H5G_t *)obj;
+ if ((args->args.get_gcpl.gcpl_id = H5G_get_create_plist((H5G_t *)obj)) < 0)
+ HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't get creation property list for group")
- if ((*new_gcpl_id = H5G_get_create_plist(grp)) < 0)
- HGOTO_ERROR(H5E_ARGS, H5E_CANTGET, FAIL, "can't get creation property list for group")
break;
}
/* H5Gget_info */
case H5VL_GROUP_GET_INFO: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- H5G_info_t * group_info = HDva_arg(arguments, H5G_info_t *);
- H5G_loc_t loc;
+ H5VL_group_get_info_args_t *get_info_args = &args->args.get_info;
+ H5G_loc_t loc;
- if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
+ if (H5G_loc_real(obj, get_info_args->loc_params.obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- if (loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if (get_info_args->loc_params.type == H5VL_OBJECT_BY_SELF) {
/* H5Gget_info */
/* Retrieve the group's information */
- if (H5G__obj_info(loc.oloc, group_info) < 0)
+ if (H5G__obj_info(loc.oloc, get_info_args->ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
} /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ else if (get_info_args->loc_params.type == H5VL_OBJECT_BY_NAME) {
/* H5Gget_info_by_name */
/* Retrieve the group's information */
- if (H5G__get_info_by_name(&loc, loc_params->loc_data.loc_by_name.name, group_info) < 0)
+ if (H5G__get_info_by_name(&loc, get_info_args->loc_params.loc_data.loc_by_name.name,
+ get_info_args->ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
} /* end else-if */
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ else if (get_info_args->loc_params.type == H5VL_OBJECT_BY_IDX) {
/* H5Gget_info_by_idx */
/* Retrieve the group's information */
- if (H5G__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, group_info) < 0)
+ if (H5G__get_info_by_idx(&loc, get_info_args->loc_params.loc_data.loc_by_idx.name,
+ get_info_args->loc_params.loc_data.loc_by_idx.idx_type,
+ get_info_args->loc_params.loc_data.loc_by_idx.order,
+ get_info_args->loc_params.loc_data.loc_by_idx.n,
+ get_info_args->ginfo) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "can't retrieve group info")
} /* end else-if */
else
@@ -243,30 +242,53 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5G_t *grp = (H5G_t *)obj;
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (specific_type) {
- case H5VL_GROUP_FLUSH: {
- hid_t group_id = HDva_arg(arguments, hid_t);
+ switch (args->op_type) {
+ /* H5Fmount */
+ case H5VL_GROUP_MOUNT: {
+ H5G_loc_t loc;
+
+ if (H5G_loc_real(grp, H5I_GROUP, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object")
+
+ if (H5F_mount(&loc, args->args.mount.name, args->args.mount.child_file,
+ args->args.mount.fmpl_id) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_MOUNT, FAIL, "unable to mount file")
+
+ break;
+ }
+
+ /* H5Funmount */
+ case H5VL_GROUP_UNMOUNT: {
+ H5G_loc_t loc;
+
+ if (H5G_loc_real(grp, H5I_GROUP, &loc) < 0)
+ HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a group object")
+
+ if (H5F_unmount(&loc, args->args.unmount.name) < 0)
+ HGOTO_ERROR(H5E_FILE, H5E_UNMOUNT, FAIL, "unable to unmount file")
- /* Flush object's metadata to file */
- if (H5O_flush_common(&grp->oloc, group_id) < 0)
+ break;
+ }
+
+ /* H5Gflush */
+ case H5VL_GROUP_FLUSH: {
+ if (H5O_flush_common(&grp->oloc, args->args.flush.grp_id) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTFLUSH, FAIL, "unable to flush group")
break;
}
+ /* H5Grefresh */
case H5VL_GROUP_REFRESH: {
- hid_t group_id = HDva_arg(arguments, hid_t);
-
- /* Call private function to refresh group object */
- if ((H5O_refresh_metadata(group_id, grp->oloc)) < 0)
+ if ((H5O_refresh_metadata(&grp->oloc, args->args.refresh.grp_id)) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTLOAD, FAIL, "unable to refresh group")
break;
@@ -290,50 +312,53 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_group_optional_t optional_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req,
- va_list H5_ATTR_DEPRECATED_USED arguments)
+H5VL__native_group_optional(void H5_ATTR_UNUSED *obj, H5VL_optional_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
- herr_t ret_value = SUCCEED; /* Return value */
+#ifndef H5_NO_DEPRECATED_SYMBOLS
+ H5VL_native_group_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+#endif /* H5_NO_DEPRECATED_SYMBOLS */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (optional_type) {
+ switch (args->op_type) {
#ifndef H5_NO_DEPRECATED_SYMBOLS
/* H5Giterate (deprecated) */
case H5VL_NATIVE_GROUP_ITERATE_OLD: {
- const H5VL_loc_params_t * loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- hsize_t idx = HDva_arg(arguments, hsize_t);
- hsize_t * last_obj = HDva_arg(arguments, hsize_t *);
- const H5G_link_iterate_t *lnk_op = HDva_arg(arguments, const H5G_link_iterate_t *);
- void * op_data = HDva_arg(arguments, void *);
- H5G_loc_t grp_loc;
+ H5VL_native_group_iterate_old_t *iter_args = &opt_args->iterate_old;
+ H5G_link_iterate_t lnk_op; /* Link operator */
+ H5G_loc_t grp_loc;
/* Get the location struct for the object */
- if (H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
+ if (H5G_loc_real(obj, iter_args->loc_params.obj_type, &grp_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ /* Set up link iteration callback struct */
+ lnk_op.op_type = H5G_LINK_OP_OLD;
+ lnk_op.op_func.op_old = iter_args->op;
+
/* Call the actual iteration routine */
- if ((ret_value = H5G_iterate(&grp_loc, loc_params->loc_data.loc_by_name.name, H5_INDEX_NAME,
- H5_ITER_INC, idx, last_obj, lnk_op, op_data)) < 0)
- HERROR(H5E_VOL, H5E_BADITER, "error iterating over group's links");
+ if ((ret_value = H5G_iterate(&grp_loc, iter_args->loc_params.loc_data.loc_by_name.name,
+ H5_INDEX_NAME, H5_ITER_INC, iter_args->idx, iter_args->last_obj,
+ &lnk_op, iter_args->op_data)) < 0)
+ HERROR(H5E_SYM, H5E_BADITER, "error iterating over group's links");
break;
}
/* H5Gget_objinfo (deprecated) */
case H5VL_NATIVE_GROUP_GET_OBJINFO: {
- const H5VL_loc_params_t *loc_params = HDva_arg(arguments, const H5VL_loc_params_t *);
- hbool_t follow_link = (hbool_t)HDva_arg(arguments, unsigned);
- H5G_stat_t * statbuf = HDva_arg(arguments, H5G_stat_t *);
- H5G_loc_t grp_loc;
+ H5VL_native_group_get_objinfo_t *goi_args = &opt_args->get_objinfo;
+ H5G_loc_t grp_loc;
/* Get the location struct for the object */
- if (H5G_loc_real(obj, loc_params->obj_type, &grp_loc) < 0)
+ if (H5G_loc_real(obj, goi_args->loc_params.obj_type, &grp_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
/* Call the actual group objinfo routine */
- if (H5G__get_objinfo(&grp_loc, loc_params->loc_data.loc_by_name.name, follow_link, statbuf) < 0)
+ if (H5G__get_objinfo(&grp_loc, goi_args->loc_params.loc_data.loc_by_name.name,
+ goi_args->follow_link, goi_args->statbuf) < 0)
HGOTO_ERROR(H5E_SYM, H5E_CANTGET, FAIL, "cannot stat object")
break;
diff --git a/src/H5VLnative_introspect.c b/src/H5VLnative_introspect.c
index 45efcf8..fa11bea 100644
--- a/src/H5VLnative_introspect.c
+++ b/src/H5VLnative_introspect.c
@@ -52,8 +52,9 @@
/* Local Variables */
/*******************/
-/* Note: H5VL__native_introspect_get_conn_cls is in src/H5VLnative.c so that
- * it can return the address of the staticly declared class struct.
+/* Note: H5VL__native_introspect_get_conn_cls and H5VL__native_introspect_get_cap_flags
+ * are in src/H5VLnative.c so that they can work with the staticly declared
+ * class struct.
*/
/*---------------------------------------------------------------------------
diff --git a/src/H5VLnative_link.c b/src/H5VLnative_link.c
index eaba18f..042c778 100644
--- a/src/H5VLnative_link.c
+++ b/src/H5VLnative_link.c
@@ -68,20 +68,20 @@
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H5VL_loc_params_t *loc_params,
+H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
hid_t lcpl_id, hid_t H5_ATTR_UNUSED lapl_id, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+ void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
- switch (create_type) {
+ switch (args->op_type) {
case H5VL_LINK_CREATE_HARD: {
H5G_loc_t cur_loc;
H5G_loc_t link_loc;
- void * cur_obj = HDva_arg(arguments, void *);
- H5VL_loc_params_t *cur_params = HDva_arg(arguments, H5VL_loc_params_t *);
+ void * cur_obj = args->args.hard.curr_obj;
+ H5VL_loc_params_t *cur_params = &args->args.hard.curr_loc_params;
if (NULL != cur_obj && H5G_loc_real(cur_obj, cur_params->obj_type, &cur_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
@@ -104,46 +104,40 @@ H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj, const H
"source and destination should be in the same file.")
/* Create the link */
- if ((ret_value =
- H5L__create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p,
- loc_params->loc_data.loc_by_name.name, lcpl_id)) < 0)
+ if (H5L__create_hard(cur_loc_p, cur_params->loc_data.loc_by_name.name, link_loc_p,
+ loc_params->loc_data.loc_by_name.name, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
} /* end if */
else { /* H5Olink */
/* Link to the object */
if (H5L_link(&link_loc, loc_params->loc_data.loc_by_name.name, &cur_loc, lcpl_id) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_CANTINIT, FAIL, "unable to create link")
+ HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
} /* end else */
+
break;
}
case H5VL_LINK_CREATE_SOFT: {
- char * target_name = HDva_arg(arguments, char *);
H5G_loc_t link_loc; /* Group location for new link */
if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
+ if (H5L__create_soft(args->args.soft.target, &link_loc, loc_params->loc_data.loc_by_name.name,
+ lcpl_id) < 0)
+ HGOTO_ERROR(H5E_LINK, H5E_CANTCREATE, FAIL, "unable to create link")
- /* Create the link */
- if ((ret_value = H5L__create_soft(target_name, &link_loc, loc_params->loc_data.loc_by_name.name,
- lcpl_id)) < 0)
- HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
break;
}
case H5VL_LINK_CREATE_UD: {
- H5G_loc_t link_loc; /* Group location for new link */
- H5L_type_t link_type = (H5L_type_t)HDva_arg(arguments, int);
- void * udata = HDva_arg(arguments, void *);
- size_t udata_size = HDva_arg(arguments, size_t);
+ H5G_loc_t link_loc; /* Group location for new link */
if (H5G_loc_real(obj, loc_params->obj_type, &link_loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Create link */
- if (H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, udata, udata_size, link_type,
- lcpl_id) < 0)
+ if (H5L__create_ud(&link_loc, loc_params->loc_data.loc_by_name.name, args->args.ud.buf,
+ args->args.ud.buf_size, args->args.ud.type, lcpl_id) < 0)
HGOTO_ERROR(H5E_LINK, H5E_CANTINIT, FAIL, "unable to create link")
+
break;
}
@@ -249,8 +243,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -260,20 +254,19 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (get_type) {
+ switch (args->op_type) {
/* H5Lget_info/H5Lget_info_by_idx */
case H5VL_LINK_GET_INFO: {
- H5L_info2_t *linfo2 = HDva_arg(arguments, H5L_info2_t *);
-
/* Get the link information */
- if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_info */
- if (H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, linfo2) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5L_get_info(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_info.linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_info_by_idx */
- if (H5L__get_info_by_idx(
- &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n, linfo2) < 0)
+ } /* end if */
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ if (H5L__get_info_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order,
+ loc_params->loc_data.loc_by_idx.n, args->args.get_info.linfo) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
} /* end else-if */
else
@@ -284,15 +277,11 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
/* H5Lget_name_by_idx */
case H5VL_LINK_GET_NAME: {
- char * name = HDva_arg(arguments, char *);
- size_t size = HDva_arg(arguments, size_t);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
-
- /* Get the link name */
- if ((*ret = H5L__get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, name, size)) < 0)
+ if (H5L__get_name_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
+ loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n,
+ args->args.get_name.name, args->args.get_name.name_size,
+ args->args.get_name.name_len) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link info")
break;
@@ -300,20 +289,17 @@ H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_
/* H5Lget_val/H5Lget_val_by_idx */
case H5VL_LINK_GET_VAL: {
- void * buf = HDva_arg(arguments, void *);
- size_t size = HDva_arg(arguments, size_t);
-
/* Get the link information */
- if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Lget_val */
- if (H5L__get_val(&loc, loc_params->loc_data.loc_by_name.name, buf, size) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5L__get_val(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_val.buf,
+ args->args.get_val.buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link value")
}
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Lget_val_by_idx */
-
- if (H5L__get_val_by_idx(&loc, loc_params->loc_data.loc_by_idx.name,
- loc_params->loc_data.loc_by_idx.idx_type,
- loc_params->loc_data.loc_by_idx.order,
- loc_params->loc_data.loc_by_idx.n, buf, size) < 0)
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ if (H5L__get_val_by_idx(
+ &loc, loc_params->loc_data.loc_by_idx.name, loc_params->loc_data.loc_by_idx.idx_type,
+ loc_params->loc_data.loc_by_idx.order, loc_params->loc_data.loc_by_idx.n,
+ args->args.get_val.buf, args->args.get_val.buf_size) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to get link val")
}
else
@@ -340,35 +326,28 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_specific_t specific_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_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) {
case H5VL_LINK_EXISTS: {
- hbool_t * exists = HDva_arg(arguments, hbool_t *);
H5G_loc_t loc;
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
-
- /* Check for the existence of the link */
- if (H5L__exists(&loc, loc_params->loc_data.loc_by_name.name, exists) < 0)
+ if (H5L__exists(&loc, loc_params->loc_data.loc_by_name.name, args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_LINK, H5E_NOTFOUND, FAIL, "unable to specific link info")
+
break;
}
case H5VL_LINK_ITER: {
- H5G_loc_t loc;
- hbool_t recursive = (hbool_t)HDva_arg(arguments, unsigned);
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- hsize_t * idx_p = HDva_arg(arguments, hsize_t *);
- H5L_iterate2_t op = HDva_arg(arguments, H5L_iterate2_t);
- void * op_data = HDva_arg(arguments, void *);
+ H5VL_link_iterate_args_t *iter_args = &args->args.iterate;
+ H5G_loc_t loc;
/* Get the location */
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
@@ -376,28 +355,32 @@ H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
/* Visit or iterate over the links */
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
- if (recursive) {
+ if (iter_args->recursive) {
/* H5Lvisit */
- if ((ret_value = H5G_visit(&loc, ".", idx_type, order, op, op_data)) < 0)
+ if ((ret_value = H5G_visit(&loc, ".", iter_args->idx_type, iter_args->order,
+ iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
} /* end if */
else {
/* H5Literate */
- if ((ret_value = H5L_iterate(&loc, ".", idx_type, order, idx_p, op, op_data)) < 0)
+ if ((ret_value = H5L_iterate(&loc, ".", iter_args->idx_type, iter_args->order,
+ iter_args->idx_p, iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
} /* end else */
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
- if (recursive) {
+ if (iter_args->recursive) {
/* H5Lvisit_by_name */
- if ((ret_value = H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- op, op_data)) < 0)
+ if ((ret_value =
+ H5G_visit(&loc, loc_params->loc_data.loc_by_name.name, iter_args->idx_type,
+ iter_args->order, iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "link visitation failed")
} /* end if */
else {
/* H5Literate_by_name */
- if ((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order,
- idx_p, op, op_data)) < 0)
+ if ((ret_value = H5L_iterate(&loc, loc_params->loc_data.loc_by_name.name,
+ iter_args->idx_type, iter_args->order, iter_args->idx_p,
+ iter_args->op, iter_args->op_data)) < 0)
HGOTO_ERROR(H5E_LINK, H5E_BADITER, FAIL, "error iterating over links")
} /* end else */
} /* end else-if */
diff --git a/src/H5VLnative_object.c b/src/H5VLnative_object.c
index 95d4fff..d237617 100644
--- a/src/H5VLnative_object.c
+++ b/src/H5VLnative_object.c
@@ -169,8 +169,8 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
herr_t ret_value = SUCCEED; /* Return value */
H5G_loc_t loc; /* Location of group */
@@ -180,14 +180,12 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (get_type) {
+ switch (args->op_type) {
/* Object file */
case H5VL_OBJECT_GET_FILE: {
- void **ret = HDva_arg(arguments, void **);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
- *ret = (void *)loc.oloc->file;
+ *args->args.get_file.file = (void *)loc.oloc->file;
/* TODO we currently need to set id_exists to TRUE because
* the upper layer will create an ID from the returned
@@ -197,18 +195,16 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
}
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_file parameters")
+
break;
}
/* Object name */
case H5VL_OBJECT_GET_NAME: {
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
- char * name = HDva_arg(arguments, char *);
- size_t size = HDva_arg(arguments, size_t);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
/* Retrieve object's name */
- if ((*ret = H5G_get_name(&loc, name, size, NULL)) < 0)
+ if (H5G_get_name(&loc, args->args.get_name.buf, args->args.get_name.buf_size,
+ args->args.get_name.name_len, NULL) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't retrieve object name")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_TOKEN) {
@@ -225,18 +221,18 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
"can't deserialize object token into address")
/* Retrieve object's name */
- if ((*ret = H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, name, size)) < 0)
+ if (H5G_get_name_by_addr(loc.oloc->file, &obj_oloc, args->args.get_name.buf,
+ args->args.get_name.buf_size, args->args.get_name.name_len) < 0)
HGOTO_ERROR(H5E_VOL, H5E_CANTGET, FAIL, "can't determine object name")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_name parameters")
+
break;
}
/* Object type */
case H5VL_OBJECT_GET_TYPE: {
- H5O_type_t *obj_type = HDva_arg(arguments, H5O_type_t *);
-
if (loc_params->type == H5VL_OBJECT_BY_TOKEN) {
H5O_loc_t obj_oloc; /* Object location */
unsigned rc; /* Reference count of object */
@@ -253,35 +249,30 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
/* Get the # of links for object, and its type */
/* (To check to make certain that this object hasn't been deleted) */
- if (H5O_get_rc_and_type(&obj_oloc, &rc, obj_type) < 0 || 0 == rc)
+ if (H5O_get_rc_and_type(&obj_oloc, &rc, args->args.get_type.obj_type) < 0 || 0 == rc)
HGOTO_ERROR(H5E_REFERENCE, H5E_LINKCOUNT, FAIL, "dereferencing deleted object")
}
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown get_type parameters")
+
break;
}
/* H5Oget_info(_name|_by_idx)3 */
case H5VL_OBJECT_GET_INFO: {
- H5O_info2_t *oinfo = HDva_arg(arguments, H5O_info2_t *);
- unsigned fields = HDva_arg(arguments, unsigned);
-
- /* Use the original H5Oget_info code to get the data */
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
- /* Retrieve the object's information */
- if (H5G_loc_info(&loc, ".", oinfo, fields) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if (H5G_loc_info(&loc, ".", args->args.get_info.oinfo, args->args.get_info.fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end if */
- else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
- /* Retrieve the object's information */
- if (H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, oinfo, fields) < 0)
+ } /* end if */
+ else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
+ if (H5G_loc_info(&loc, loc_params->loc_data.loc_by_name.name, args->args.get_info.oinfo,
+ args->args.get_info.fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
- } /* end else-if */
- else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
- H5G_loc_t obj_loc; /* Location used to open group */
- H5G_name_t obj_path; /* Opened object group hier. path */
- H5O_loc_t obj_oloc; /* Opened object object location */
+ } /* end else-if */
+ else if (loc_params->type == H5VL_OBJECT_BY_IDX) {
+ H5G_loc_t obj_loc; /* Location used to open group */
+ H5G_name_t obj_path; /* Opened object group hier. path */
+ H5O_loc_t obj_oloc; /* Opened object object location */
/* Set up opened group location to fill in */
obj_loc.oloc = &obj_oloc;
@@ -296,7 +287,7 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
/* Retrieve the object's information */
- if (H5O_get_info(obj_loc.oloc, oinfo, fields) < 0) {
+ if (H5O_get_info(obj_loc.oloc, args->args.get_info.oinfo, args->args.get_info.fields) < 0) {
H5G_loc_free(&obj_loc);
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
} /* end if */
@@ -307,6 +298,7 @@ H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_obj
} /* end else-if */
else
HGOTO_ERROR(H5E_OHDR, H5E_UNSUPPORTED, FAIL, "unknown get info parameters")
+
break;
}
@@ -329,8 +321,8 @@ done:
*/
herr_t
H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t H5_ATTR_UNUSED dxpl_id,
+ void H5_ATTR_UNUSED **req)
{
H5G_loc_t loc;
herr_t ret_value = SUCCEED; /* Return value */
@@ -340,13 +332,10 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (specific_type) {
+ switch (args->op_type) {
/* H5Oincr_refcount / H5Odecr_refcount */
case H5VL_OBJECT_CHANGE_REF_COUNT: {
- int update_ref = HDva_arg(arguments, int);
- H5O_loc_t *oloc = loc.oloc;
-
- if (H5O_link(oloc, update_ref) < 0)
+ if (H5O_link(loc.oloc, args->args.change_rc.delta) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_LINKCOUNT, FAIL, "modifying object link count failed")
break;
@@ -354,25 +343,20 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
/* H5Oexists_by_name */
case H5VL_OBJECT_EXISTS: {
- htri_t *ret = HDva_arg(arguments, htri_t *);
-
if (loc_params->type == H5VL_OBJECT_BY_NAME) {
/* Check if the object exists */
- if ((*ret = H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name)) < 0)
+ if (H5G_loc_exists(&loc, loc_params->loc_data.loc_by_name.name, args->args.exists.exists) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine if '%s' exists",
loc_params->loc_data.loc_by_name.name)
} /* end if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object exists parameters")
+
break;
}
/* Lookup object */
case H5VL_OBJECT_LOOKUP: {
- H5O_token_t *token = HDva_arg(arguments, H5O_token_t *);
-
- HDassert(token);
-
if (loc_params->type == H5VL_OBJECT_BY_NAME) {
H5G_loc_t obj_loc; /* Group hier. location of object */
H5G_name_t obj_path; /* Object group hier. path */
@@ -388,7 +372,8 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
/* Encode token */
- if (H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr, token) < 0)
+ if (H5VL_native_addr_to_token(loc.oloc->file, H5I_FILE, obj_loc.oloc->addr,
+ args->args.lookup.token_ptr) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTSERIALIZE, FAIL,
"can't serialize address into object token")
@@ -401,46 +386,39 @@ H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
break;
}
+ /* H5Ovisit/H5Ovisit_by_name */
case H5VL_OBJECT_VISIT: {
- H5_index_t idx_type = (H5_index_t)HDva_arg(arguments, int); /* enum work-around */
- H5_iter_order_t order = (H5_iter_order_t)HDva_arg(arguments, int); /* enum work-around */
- H5O_iterate2_t op = HDva_arg(arguments, H5O_iterate2_t);
- void * op_data = HDva_arg(arguments, void *);
- unsigned fields = HDva_arg(arguments, unsigned);
+ H5VL_object_visit_args_t *visit_args = &args->args.visit;
/* Call internal object visitation routine */
if (loc_params->type == H5VL_OBJECT_BY_SELF) {
- /* H5Ovisit */
- if ((ret_value = H5O__visit(&loc, ".", idx_type, order, op, op_data, fields)) < 0)
+ if ((ret_value = H5O__visit(&loc, ".", visit_args->idx_type, visit_args->order,
+ visit_args->op, visit_args->op_data, visit_args->fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) {
- /* H5Ovisit_by_name */
- if ((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, idx_type, order, op,
- op_data, fields)) < 0)
+ if ((ret_value = H5O__visit(&loc, loc_params->loc_data.loc_by_name.name, visit_args->idx_type,
+ visit_args->order, visit_args->op, visit_args->op_data,
+ visit_args->fields)) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_BADITER, FAIL, "object visitation failed")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown object visit params");
+
break;
}
case H5VL_OBJECT_FLUSH: {
- hid_t oid = HDva_arg(arguments, hid_t);
-
/* Flush the object's metadata */
- if (H5O_flush(loc.oloc, oid) < 0)
+ if (H5O_flush(loc.oloc, args->args.flush.obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTFLUSH, FAIL, "unable to flush object")
break;
}
case H5VL_OBJECT_REFRESH: {
- hid_t oid = HDva_arg(arguments, hid_t);
- H5O_loc_t *oloc = loc.oloc;
-
/* Refresh the metadata */
- if (H5O_refresh_metadata(oid, *oloc) < 0)
+ if (H5O_refresh_metadata(loc.oloc, args->args.refresh.obj_id) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTLOAD, FAIL, "unable to refresh object")
break;
@@ -464,64 +442,59 @@ done:
*-------------------------------------------------------------------------
*/
herr_t
-H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hid_t H5_ATTR_UNUSED dxpl_id,
- void H5_ATTR_UNUSED **req, va_list arguments)
+H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t H5_ATTR_UNUSED dxpl_id, void H5_ATTR_UNUSED **req)
{
- H5VL_loc_params_t *loc_params = HDva_arg(arguments, H5VL_loc_params_t *);
- H5G_loc_t loc; /* Location of group */
- herr_t ret_value = SUCCEED; /* Return value */
+ H5G_loc_t loc; /* Location of group */
+ H5VL_native_object_optional_args_t *opt_args = args->args; /* Pointer to native operation's arguments */
+ herr_t ret_value = SUCCEED; /* Return value */
FUNC_ENTER_PACKAGE
if (H5G_loc_real(obj, loc_params->obj_type, &loc) < 0)
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a file or file object")
- switch (optional_type) {
+ switch (args->op_type) {
/* H5Oget_comment / H5Oget_comment_by_name */
case H5VL_NATIVE_OBJECT_GET_COMMENT: {
- char * comment = HDva_arg(arguments, char *);
- size_t bufsize = HDva_arg(arguments, size_t);
- ssize_t *ret = HDva_arg(arguments, ssize_t *);
+ H5VL_native_object_get_comment_t *gc_args = &opt_args->get_comment;
/* Retrieve the object's comment */
if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_comment */
- if ((*ret = H5G_loc_get_comment(&loc, ".", comment /*out*/, bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ if (H5G_loc_get_comment(&loc, ".", gc_args->buf, gc_args->buf_size, gc_args->comment_len) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_comment_by_name */
- if ((*ret = H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, comment /*out*/,
- bufsize)) < 0)
- HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
+ if (H5G_loc_get_comment(&loc, loc_params->loc_data.loc_by_name.name, gc_args->buf,
+ gc_args->buf_size, gc_args->comment_len) < 0)
+ HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't get comment for object")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
+
break;
}
/* H5Oset_comment */
case H5VL_NATIVE_OBJECT_SET_COMMENT: {
- const char *comment = HDva_arg(arguments, char *);
-
if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oset_comment */
- /* (Re)set the object's comment */
- if (H5G_loc_set_comment(&loc, ".", comment) < 0)
+ if (H5G_loc_set_comment(&loc, ".", opt_args->set_comment.comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oset_comment_by_name */
- /* (Re)set the object's comment */
- if (H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name, comment) < 0)
+ if (H5G_loc_set_comment(&loc, loc_params->loc_data.loc_by_name.name,
+ opt_args->set_comment.comment) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end else-if */
else
HGOTO_ERROR(H5E_VOL, H5E_UNSUPPORTED, FAIL, "unknown set_coment parameters")
+
break;
}
/* H5Odisable_mdc_flushes */
case H5VL_NATIVE_OBJECT_DISABLE_MDC_FLUSHES: {
- H5O_loc_t *oloc = loc.oloc;
-
- if (H5O_disable_mdc_flushes(oloc) < 0)
+ if (H5O__disable_mdc_flushes(loc.oloc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTCORK, FAIL, "unable to cork the metadata cache");
break;
@@ -529,9 +502,7 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
/* H5Oenable_mdc_flushes */
case H5VL_NATIVE_OBJECT_ENABLE_MDC_FLUSHES: {
- H5O_loc_t *oloc = loc.oloc;
-
- if (H5O_enable_mdc_flushes(oloc) < 0)
+ if (H5O__enable_mdc_flushes(loc.oloc) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTUNCORK, FAIL, "unable to uncork the metadata cache");
break;
@@ -539,10 +510,7 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
/* H5Oare_mdc_flushes_disabled */
case H5VL_NATIVE_OBJECT_ARE_MDC_FLUSHES_DISABLED: {
- H5O_loc_t *oloc = loc.oloc;
- hbool_t * are_disabled = (hbool_t *)HDva_arg(arguments, hbool_t *);
-
- if (H5O_are_mdc_flushes_disabled(oloc, are_disabled) < 0)
+ if (H5O__are_mdc_flushes_disabled(loc.oloc, opt_args->are_mdc_flushes_disabled.flag) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "unable to determine metadata cache cork status");
break;
@@ -550,19 +518,16 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
/* H5Oget_native_info(_name|_by_idx) */
case H5VL_NATIVE_OBJECT_GET_NATIVE_INFO: {
- H5O_native_info_t *native_info = HDva_arg(arguments, H5O_native_info_t *);
- unsigned fields = HDva_arg(arguments, unsigned);
+ H5VL_native_object_get_native_info_t *gni_args = &opt_args->get_native_info;
/* Use the original H5Oget_info code to get the data */
-
- if (loc_params->type == H5VL_OBJECT_BY_SELF) { /* H5Oget_info */
- /* Retrieve the object's information */
- if (H5G_loc_native_info(&loc, ".", native_info, fields) < 0)
+ if (loc_params->type == H5VL_OBJECT_BY_SELF) {
+ if (H5G_loc_native_info(&loc, ".", gni_args->ninfo, gni_args->fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end if */
else if (loc_params->type == H5VL_OBJECT_BY_NAME) { /* H5Oget_info_by_name */
- /* Retrieve the object's information */
- if (H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, native_info, fields) < 0)
+ if (H5G_loc_native_info(&loc, loc_params->loc_data.loc_by_name.name, gni_args->ninfo,
+ gni_args->fields) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "object not found")
} /* end else-if */
else if (loc_params->type == H5VL_OBJECT_BY_IDX) { /* H5Oget_info_by_idx */
@@ -582,8 +547,7 @@ H5VL__native_object_optional(void *obj, H5VL_object_optional_t optional_type, hi
loc_params->loc_data.loc_by_idx.n, &obj_loc /*out*/) < 0)
HGOTO_ERROR(H5E_OHDR, H5E_NOTFOUND, FAIL, "group not found")
- /* Retrieve the object's information */
- if (H5O_get_native_info(obj_loc.oloc, native_info, fields) < 0) {
+ if (H5O_get_native_info(obj_loc.oloc, gni_args->ninfo, gni_args->fields) < 0) {
H5G_loc_free(&obj_loc);
HGOTO_ERROR(H5E_OHDR, H5E_CANTGET, FAIL, "can't retrieve object info")
} /* end if */
diff --git a/src/H5VLnative_private.h b/src/H5VLnative_private.h
index 687221a..1fd90c8 100644
--- a/src/H5VLnative_private.h
+++ b/src/H5VLnative_private.h
@@ -49,13 +49,10 @@ void * H5VL__native_attr_open(void *obj, const H5VL_loc_params_t *loc_par
hid_t aapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_read(void *attr, hid_t dtype_id, void *buf, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_write(void *attr, hid_t dtype_id, const void *buf, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VL__native_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
@@ -68,12 +65,11 @@ H5_DLL herr_t H5VL__native_dataset_read(void *dset, hid_t mem_type_id, hid_t mem
hid_t file_space_id, hid_t plist_id, void *buf, void **req);
H5_DLL herr_t H5VL__native_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf, void **req);
-H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_dataset_optional(void *dset, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_dataset_specific(void *dset, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL__native_dataset_optional(void *dset, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL__native_dataset_close(void *dset, hid_t dxpl_id, void **req);
/* Datatype callbacks */
@@ -82,10 +78,9 @@ H5_DLL void * H5VL__native_datatype_commit(void *obj, const H5VL_loc_params_t *l
hid_t dxpl_id, void **req);
H5_DLL void * H5VL__native_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_datatype_specific(void *dt, H5VL_datatype_specific_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL__native_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* File callbacks */
@@ -93,12 +88,10 @@ H5_DLL void * H5VL__native_file_create(const char *name, unsigned flags, hid_t f
hid_t dxpl_id, void **req);
H5_DLL void * H5VL__native_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
void **req);
-H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments);
+H5_DLL herr_t H5VL__native_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL__native_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
@@ -107,29 +100,26 @@ H5_DLL void * H5VL__native_group_create(void *obj, const H5VL_loc_params_t *loc_
void **req);
H5_DLL void * H5VL__native_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-H5_DLL herr_t H5VL__native_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL__native_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
-H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_type_t create_type, void *obj,
+H5_DLL herr_t H5VL__native_link_create(H5VL_link_create_args_t *args, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, va_list arguments);
+ hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments);
+H5_DLL herr_t H5VL__native_link_get(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
/* Object callbacks */
H5_DLL void *H5VL__native_object_open(void *obj, const H5VL_loc_params_t *loc_params, H5I_type_t *opened_type,
@@ -139,25 +129,23 @@ H5_DLL herr_t H5VL__native_object_copy(void *src_obj, const H5VL_loc_params_t *l
const H5VL_loc_params_t *loc_params2, const char *dst_name,
hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_object_get(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL__native_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-H5_DLL herr_t H5VL__native_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL__native_object_optional(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Connector/container introspection functions */
H5_DLL herr_t H5VL__native_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VL__native_introspect_get_cap_flags(const void *info, unsigned *cap_flags);
H5_DLL herr_t H5VL__native_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type,
uint64_t *flags);
/* Blob callbacks */
H5_DLL herr_t H5VL__native_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
H5_DLL herr_t H5VL__native_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
-H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments);
+H5_DLL herr_t H5VL__native_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
/* Token callbacks */
H5_DLL herr_t H5VL__native_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2,
diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c
index 5ccc082..681531e 100644
--- a/src/H5VLpassthru.c
+++ b/src/H5VLpassthru.c
@@ -77,15 +77,6 @@ typedef struct H5VL_pass_through_wrap_ctx_t {
/********************* */
/* Helper routines */
-static herr_t H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id,
- H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, ...);
-static herr_t H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
- H5VL_request_specific_t specific_type, ...);
-static herr_t H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t connector_id,
- hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req,
- ...);
static H5VL_pass_through_t *H5VL_pass_through_new_obj(void *under_obj, hid_t under_vol_id);
static herr_t H5VL_pass_through_free_obj(H5VL_pass_through_t *obj);
@@ -117,13 +108,11 @@ static herr_t H5VL_pass_through_attr_read(void *attr, hid_t mem_type_id, void *b
void **req);
static herr_t H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid_t dxpl_id,
void **req);
-static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+static herr_t H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_attr_close(void *attr, hid_t dxpl_id, void **req);
/* Dataset callbacks */
@@ -137,12 +126,12 @@ static herr_t H5VL_pass_through_dataset_read(void *dset, hid_t mem_type_id, hid_
static herr_t H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t plist_id, const void *buf,
void **req);
-static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_dataset_close(void *dset, hid_t dxpl_id, void **req);
/* Datatype callbacks */
@@ -151,12 +140,12 @@ static void *H5VL_pass_through_datatype_commit(void *obj, const H5VL_loc_params_
hid_t tapl_id, hid_t dxpl_id, void **req);
static void *H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t tapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, va_list arguments);
-static herr_t H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_datatype_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_datatype_close(void *dt, hid_t dxpl_id, void **req);
/* File callbacks */
@@ -164,12 +153,11 @@ static void * H5VL_pass_through_file_create(const char *name, unsigned flags, hi
hid_t dxpl_id, void **req);
static void * H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid_t dxpl_id,
void **req);
-static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_file_close(void *file, hid_t dxpl_id, void **req);
/* Group callbacks */
@@ -178,18 +166,17 @@ static void * H5VL_pass_through_group_create(void *obj, const H5VL_loc_params_t
void **req);
static void * H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, const char *name,
hid_t gapl_id, hid_t dxpl_id, void **req);
-static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+static herr_t H5VL_pass_through_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+static herr_t H5VL_pass_through_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
static herr_t H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req);
/* Link callbacks */
-static herr_t H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
+static herr_t H5VL_pass_through_link_create(H5VL_link_create_args_t *args, void *obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, va_list arguments);
+ hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_copy(void *src_obj, const H5VL_loc_params_t *loc_params1, void *dst_obj,
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
@@ -197,13 +184,11 @@ static herr_t H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t
const H5VL_loc_params_t *loc_params2, hid_t lcpl_id, hid_t lapl_id,
hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments);
-static herr_t H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_link_optional(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Object callbacks */
static void * H5VL_pass_through_object_open(void *obj, const H5VL_loc_params_t *loc_params,
@@ -213,17 +198,16 @@ static herr_t H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params
const H5VL_loc_params_t *dst_loc_params, const char *dst_name,
hid_t ocpypl_id, hid_t lcpl_id, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
static herr_t H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments);
-static herr_t H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id,
- void **req, va_list arguments);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+static herr_t H5VL_pass_through_object_optional(void *obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Container/connector introspection callbacks */
static herr_t H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+static herr_t H5VL_pass_through_introspect_get_cap_flags(const void *info, unsigned *cap_flags);
static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t cls, int opt_type,
uint64_t *flags);
@@ -231,19 +215,15 @@ static herr_t H5VL_pass_through_introspect_opt_query(void *obj, H5VL_subclass_t
static herr_t H5VL_pass_through_request_wait(void *req, uint64_t timeout, H5VL_request_status_t *status);
static herr_t H5VL_pass_through_request_notify(void *obj, H5VL_request_notify_t cb, void *ctx);
static herr_t H5VL_pass_through_request_cancel(void *req, H5VL_request_status_t *status);
-static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_t specific_type,
- va_list arguments);
-static herr_t H5VL_pass_through_request_optional(void *req, H5VL_request_optional_t opt_type,
- va_list arguments);
+static herr_t H5VL_pass_through_request_specific(void *req, H5VL_request_specific_args_t *args);
+static herr_t H5VL_pass_through_request_optional(void *req, H5VL_optional_args_t *args);
static herr_t H5VL_pass_through_request_free(void *req);
/* Blob callbacks */
static herr_t H5VL_pass_through_blob_put(void *obj, const void *buf, size_t size, void *blob_id, void *ctx);
static herr_t H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t size, void *ctx);
-static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments);
-static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type,
- va_list arguments);
+static herr_t H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args);
+static herr_t H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_optional_args_t *args);
/* Token callbacks */
static herr_t H5VL_pass_through_token_cmp(void *obj, const H5O_token_t *token1, const H5O_token_t *token2,
@@ -254,8 +234,7 @@ static herr_t H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, c
H5O_token_t *token);
/* Generic optional callback */
-static herr_t H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req,
- va_list arguments);
+static herr_t H5VL_pass_through_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/*******************/
/* Local variables */
@@ -355,8 +334,9 @@ static const H5VL_class_t H5VL_pass_through_g = {
},
{
/* introspect_cls */
- H5VL_pass_through_introspect_get_conn_cls, /* get_conn_cls */
- H5VL_pass_through_introspect_opt_query, /* opt_query */
+ H5VL_pass_through_introspect_get_conn_cls, /* get_conn_cls */
+ H5VL_pass_through_introspect_get_cap_flags, /* get_cap_flags */
+ H5VL_pass_through_introspect_opt_query, /* opt_query */
},
{
/* request_cls */
@@ -1025,7 +1005,7 @@ H5VL_pass_through_attr_write(void *attr, hid_t mem_type_id, const void *buf, hid
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1034,7 +1014,7 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, v
printf("------- PASS THROUGH VOL ATTRIBUTE Get\n");
#endif
- ret_value = H5VLattr_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLattr_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1055,8 +1035,7 @@ H5VL_pass_through_attr_get(void *obj, H5VL_attr_get_t get_type, hid_t dxpl_id, v
*/
static herr_t
H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1065,8 +1044,7 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL ATTRIBUTE Specific\n");
#endif
- ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req,
- arguments);
+ ret_value = H5VLattr_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1086,8 +1064,7 @@ H5VL_pass_through_attr_specific(void *obj, const H5VL_loc_params_t *loc_params,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_attr_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1096,7 +1073,7 @@ H5VL_pass_through_attr_optional(void *obj, H5VL_attr_optional_t opt_type, hid_t
printf("------- PASS THROUGH VOL ATTRIBUTE Optional\n");
#endif
- ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLattr_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1285,8 +1262,7 @@ H5VL_pass_through_dataset_write(void *dset, hid_t mem_type_id, hid_t mem_space_i
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dset;
herr_t ret_value;
@@ -1295,7 +1271,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxp
printf("------- PASS THROUGH VOL DATASET Get\n");
#endif
- ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLdataset_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1315,8 +1291,7 @@ H5VL_pass_through_dataset_get(void *dset, H5VL_dataset_get_t get_type, hid_t dxp
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -1326,12 +1301,12 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
printf("------- PASS THROUGH VOL H5Dspecific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value =
- H5VLdataset_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+ ret_value = H5VLdataset_specific(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1351,8 +1326,7 @@ H5VL_pass_through_dataset_specific(void *obj, H5VL_dataset_specific_t specific_t
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_dataset_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1361,7 +1335,7 @@ H5VL_pass_through_dataset_optional(void *obj, H5VL_dataset_optional_t opt_type,
printf("------- PASS THROUGH VOL DATASET Optional\n");
#endif
- ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLdataset_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1488,8 +1462,7 @@ H5VL_pass_through_datatype_open(void *obj, const H5VL_loc_params_t *loc_params,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)dt;
herr_t ret_value;
@@ -1498,7 +1471,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxp
printf("------- PASS THROUGH VOL DATATYPE Get\n");
#endif
- ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLdatatype_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1518,8 +1491,7 @@ H5VL_pass_through_datatype_get(void *dt, H5VL_datatype_get_t get_type, hid_t dxp
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific_type, hid_t dxpl_id,
- void **req, va_list arguments)
+H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -1529,12 +1501,12 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
printf("------- PASS THROUGH VOL DATATYPE Specific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value =
- H5VLdatatype_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+ ret_value = H5VLdatatype_specific(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1554,8 +1526,7 @@ H5VL_pass_through_datatype_specific(void *obj, H5VL_datatype_specific_t specific
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_datatype_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -1564,7 +1535,7 @@ H5VL_pass_through_datatype_optional(void *obj, H5VL_datatype_optional_t opt_type
printf("------- PASS THROUGH VOL DATATYPE Optional\n");
#endif
- ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLdatatype_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1732,7 +1703,7 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, hid
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_file_get(void *file, H5VL_file_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
herr_t ret_value;
@@ -1741,7 +1712,7 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
printf("------- PASS THROUGH VOL FILE Get\n");
#endif
- ret_value = H5VLfile_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLfile_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -1751,31 +1722,6 @@ H5VL_pass_through_file_get(void *file, H5VL_file_get_t get_type, hid_t dxpl_id,
} /* end H5VL_pass_through_file_get() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_file_specific_reissue
- *
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * file specific callback to the underlying VOL connector.
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, ...)
-{
- va_list arguments;
- herr_t ret_value;
-
- va_start(arguments, req);
- ret_value = H5VLfile_specific(obj, connector_id, specific_type, dxpl_id, req, arguments);
- va_end(arguments);
-
- return ret_value;
-} /* end H5VL_pass_through_file_specific_reissue() */
-
-/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_file_specific
*
* Purpose: Specific operation on file
@@ -1786,106 +1732,109 @@ H5VL_pass_through_file_specific_reissue(void *obj, hid_t connector_id, H5VL_file
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_file_specific(void *file, H5VL_file_specific_args_t *args, hid_t dxpl_id, void **req)
{
- H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
- hid_t under_vol_id = -1;
- herr_t ret_value;
+ H5VL_pass_through_t * o = (H5VL_pass_through_t *)file;
+ H5VL_pass_through_t * new_o;
+ H5VL_file_specific_args_t my_args;
+ H5VL_file_specific_args_t *new_args;
+ H5VL_pass_through_info_t * info;
+ hid_t under_vol_id = -1;
+ herr_t ret_value;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL FILE Specific\n");
#endif
- /* Unpack arguments to get at the child file pointer when mounting a file */
- if (specific_type == H5VL_FILE_MOUNT) {
- H5I_type_t loc_type;
- const char * name;
- H5VL_pass_through_t *child_file;
- hid_t plist_id;
-
- /* Retrieve parameters for 'mount' operation, so we can unwrap the child file */
- loc_type = (H5I_type_t)va_arg(arguments, int); /* enum work-around */
- name = va_arg(arguments, const char *);
- child_file = (H5VL_pass_through_t *)va_arg(arguments, void *);
- plist_id = va_arg(arguments, hid_t);
-
- /* Keep the correct underlying VOL ID for possible async request token */
- under_vol_id = o->under_vol_id;
-
- /* Re-issue 'file specific' call, using the unwrapped pieces */
- ret_value = H5VL_pass_through_file_specific_reissue(o->under_object, o->under_vol_id, specific_type,
- dxpl_id, req, (int)loc_type, name,
- child_file->under_object, plist_id);
- } /* end if */
- else if (specific_type == H5VL_FILE_IS_ACCESSIBLE || specific_type == H5VL_FILE_DELETE) {
- H5VL_pass_through_info_t *info;
- hid_t fapl_id, under_fapl_id;
- const char * name;
- htri_t * ret;
-
- /* Get the arguments for the 'is accessible' check */
- fapl_id = va_arg(arguments, hid_t);
- name = va_arg(arguments, const char *);
- ret = va_arg(arguments, htri_t *);
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) {
+ /* Shallow copy the args */
+ memcpy(&my_args, args, sizeof(my_args));
/* Get copy of our VOL info from FAPL */
- H5Pget_vol_info(fapl_id, (void **)&info);
+ H5Pget_vol_info(args->args.is_accessible.fapl_id, (void **)&info);
/* Make sure we have info about the underlying VOL to be used */
if (!info)
return (-1);
+ /* Keep the correct underlying VOL ID for later */
+ under_vol_id = info->under_vol_id;
+
/* Copy the FAPL */
- under_fapl_id = H5Pcopy(fapl_id);
+ my_args.args.is_accessible.fapl_id = H5Pcopy(args->args.is_accessible.fapl_id);
/* Set the VOL ID and info for the underlying FAPL */
- H5Pset_vol(under_fapl_id, info->under_vol_id, info->under_vol_info);
+ H5Pset_vol(my_args.args.is_accessible.fapl_id, info->under_vol_id, info->under_vol_info);
- /* Keep the correct underlying VOL ID for possible async request token */
+ /* Set argument pointer to new arguments */
+ new_args = &my_args;
+
+ /* Set object pointer for operation */
+ new_o = NULL;
+ } /* end else-if */
+ else if (args->op_type == H5VL_FILE_DELETE) {
+ /* Shallow copy the args */
+ memcpy(&my_args, args, sizeof(my_args));
+
+ /* Get copy of our VOL info from FAPL */
+ H5Pget_vol_info(args->args.del.fapl_id, (void **)&info);
+
+ /* Make sure we have info about the underlying VOL to be used */
+ if (!info)
+ return (-1);
+
+ /* Keep the correct underlying VOL ID for later */
under_vol_id = info->under_vol_id;
- /* Re-issue 'file specific' call */
- ret_value = H5VL_pass_through_file_specific_reissue(NULL, info->under_vol_id, specific_type, dxpl_id,
- req, under_fapl_id, name, ret);
+ /* Copy the FAPL */
+ my_args.args.del.fapl_id = H5Pcopy(args->args.del.fapl_id);
- /* Close underlying FAPL */
- H5Pclose(under_fapl_id);
+ /* Set the VOL ID and info for the underlying FAPL */
+ H5Pset_vol(my_args.args.del.fapl_id, info->under_vol_id, info->under_vol_info);
- /* Release copy of our VOL info */
- H5VL_pass_through_info_free(info);
+ /* Set argument pointer to new arguments */
+ new_args = &my_args;
+
+ /* Set object pointer for operation */
+ new_o = NULL;
} /* end else-if */
else {
- va_list my_arguments;
-
- /* Make a copy of the argument list for later, if reopening */
- if (specific_type == H5VL_FILE_REOPEN)
- va_copy(my_arguments, arguments);
-
- /* Keep the correct underlying VOL ID for possible async request token */
+ /* Keep the correct underlying VOL ID for later */
under_vol_id = o->under_vol_id;
- ret_value =
- H5VLfile_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
-
- /* Wrap file struct pointer, if we reopened one */
- if (specific_type == H5VL_FILE_REOPEN) {
- if (ret_value >= 0) {
- void **ret = va_arg(my_arguments, void **);
+ /* Set argument pointer to current arguments */
+ new_args = args;
- if (ret && *ret)
- *ret = H5VL_pass_through_new_obj(*ret, o->under_vol_id);
- } /* end if */
+ /* Set object pointer for operation */
+ new_o = o->under_object;
+ } /* end else */
- /* Finish use of copied vararg list */
- va_end(my_arguments);
- } /* end if */
- } /* end else */
+ ret_value = H5VLfile_specific(new_o, under_vol_id, new_args, dxpl_id, req);
/* Check for async request */
if (req && *req)
*req = H5VL_pass_through_new_obj(*req, under_vol_id);
+ if (args->op_type == H5VL_FILE_IS_ACCESSIBLE) {
+ /* Close underlying FAPL */
+ H5Pclose(my_args.args.is_accessible.fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+ } /* end else-if */
+ else if (args->op_type == H5VL_FILE_DELETE) {
+ /* Close underlying FAPL */
+ H5Pclose(my_args.args.del.fapl_id);
+
+ /* Release copy of our VOL info */
+ H5VL_pass_through_info_free(info);
+ } /* end else-if */
+ else if (args->op_type == H5VL_FILE_REOPEN) {
+ /* Wrap file struct pointer for 'reopen' operation, if we reopened one */
+ if (ret_value >= 0 && *args->args.reopen.file)
+ *args->args.reopen.file = H5VL_pass_through_new_obj(*args->args.reopen.file, under_vol_id);
+ } /* end else */
+
return ret_value;
} /* end H5VL_pass_through_file_specific() */
@@ -1900,8 +1849,7 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_file_optional(void *file, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)file;
herr_t ret_value;
@@ -1910,7 +1858,7 @@ H5VL_pass_through_file_optional(void *file, H5VL_file_optional_t opt_type, hid_t
printf("------- PASS THROUGH VOL File Optional\n");
#endif
- ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLfile_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2036,8 +1984,7 @@ H5VL_pass_through_group_open(void *obj, const H5VL_loc_params_t *loc_params, con
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_group_get(void *obj, H5VL_group_get_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2046,7 +1993,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
printf("------- PASS THROUGH VOL GROUP Get\n");
#endif
- ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLgroup_get(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2066,8 +2013,7 @@ H5VL_pass_through_group_get(void *obj, H5VL_group_get_t get_type, hid_t dxpl_id,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -2077,11 +2023,27 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
printf("------- PASS THROUGH VOL GROUP Specific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value = H5VLgroup_specific(o->under_object, o->under_vol_id, specific_type, dxpl_id, req, arguments);
+ /* Unpack arguments to get at the child file pointer when mounting a file */
+ if (args->op_type == H5VL_GROUP_MOUNT) {
+ H5VL_group_specific_args_t vol_cb_args; /* New group specific arg struct */
+
+ /* Set up new VOL callback arguments */
+ vol_cb_args.op_type = H5VL_GROUP_MOUNT;
+ vol_cb_args.args.mount.name = args->args.mount.name;
+ vol_cb_args.args.mount.child_file =
+ ((H5VL_pass_through_t *)args->args.mount.child_file)->under_object;
+ vol_cb_args.args.mount.fmpl_id = args->args.mount.fmpl_id;
+
+ /* Re-issue 'group specific' call, using the unwrapped pieces */
+ ret_value = H5VLgroup_specific(o->under_object, under_vol_id, &vol_cb_args, dxpl_id, req);
+ } /* end if */
+ else
+ ret_value = H5VLgroup_specific(o->under_object, under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2101,8 +2063,7 @@ H5VL_pass_through_group_specific(void *obj, H5VL_group_specific_t specific_type,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_group_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2111,7 +2072,7 @@ H5VL_pass_through_group_optional(void *obj, H5VL_group_optional_t opt_type, hid_
printf("------- PASS THROUGH VOL GROUP Optional\n");
#endif
- ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLgroup_optional(o->under_object, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2154,33 +2115,6 @@ H5VL_pass_through_group_close(void *grp, hid_t dxpl_id, void **req)
} /* end H5VL_pass_through_group_close() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_link_create_reissue
- *
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * link create callback to the underlying VOL connector.
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t connector_id, hid_t lcpl_id,
- hid_t lapl_id, hid_t dxpl_id, void **req, ...)
-{
- va_list arguments;
- herr_t ret_value;
-
- va_start(arguments, req);
- ret_value = H5VLlink_create(create_type, obj, loc_params, connector_id, lcpl_id, lapl_id, dxpl_id, req,
- arguments);
- va_end(arguments);
-
- return ret_value;
-} /* end H5VL_pass_through_link_create_reissue() */
-
-/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_link_create
*
* Purpose: Creates a hard / soft / UD / external link.
@@ -2191,9 +2125,8 @@ H5VL_pass_through_link_create_reissue(H5VL_link_create_type_t create_type, void
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
- const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_link_create(H5VL_link_create_args_t *args, void *obj, const H5VL_loc_params_t *loc_params,
+ hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id = -1;
@@ -2208,32 +2141,22 @@ H5VL_pass_through_link_create(H5VL_link_create_type_t create_type, void *obj,
under_vol_id = o->under_vol_id;
/* Fix up the link target object for hard link creation */
- if (H5VL_LINK_CREATE_HARD == create_type) {
- void * cur_obj;
- H5VL_loc_params_t *cur_params;
+ if (H5VL_LINK_CREATE_HARD == args->op_type) {
+ void *cur_obj = args->args.hard.curr_obj;
- /* Retrieve the object & loc params for the link target */
- cur_obj = va_arg(arguments, void *);
- cur_params = va_arg(arguments, H5VL_loc_params_t *);
-
- /* If it's a non-NULL pointer, find the 'under object' and re-set the property */
+ /* If cur_obj is a non-NULL pointer, find its 'under object' and update the pointer */
if (cur_obj) {
- /* Check if we still need the "under" VOL ID */
+ /* Check if we still haven't set the "under" VOL ID */
if (under_vol_id < 0)
under_vol_id = ((H5VL_pass_through_t *)cur_obj)->under_vol_id;
- /* Set the object for the link target */
- cur_obj = ((H5VL_pass_through_t *)cur_obj)->under_object;
+ /* Update the object for the link target */
+ args->args.hard.curr_obj = ((H5VL_pass_through_t *)cur_obj)->under_object;
} /* end if */
+ } /* end if */
- /* Re-issue 'link create' call, using the unwrapped pieces */
- ret_value = H5VL_pass_through_link_create_reissue(create_type, (o ? o->under_object : NULL),
- loc_params, under_vol_id, lcpl_id, lapl_id, dxpl_id,
- req, cur_obj, cur_params);
- } /* end if */
- else
- ret_value = H5VLlink_create(create_type, (o ? o->under_object : NULL), loc_params, under_vol_id,
- lcpl_id, lapl_id, dxpl_id, req, arguments);
+ ret_value = H5VLlink_create(args, (o ? o->under_object : NULL), loc_params, under_vol_id, lcpl_id,
+ lapl_id, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2347,8 +2270,8 @@ H5VL_pass_through_link_move(void *src_obj, const H5VL_loc_params_t *loc_params1,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_link_get_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2357,7 +2280,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
printf("------- PASS THROUGH VOL LINK Get\n");
#endif
- ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLlink_get(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2378,8 +2301,7 @@ H5VL_pass_through_link_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_
*/
static herr_t
H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2388,8 +2310,7 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
printf("------- PASS THROUGH VOL LINK Specific\n");
#endif
- ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req,
- arguments);
+ ret_value = H5VLlink_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2409,8 +2330,8 @@ H5VL_pass_through_link_specific(void *obj, const H5VL_loc_params_t *loc_params,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_link_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2419,7 +2340,7 @@ H5VL_pass_through_link_optional(void *obj, H5VL_link_optional_t opt_type, hid_t
printf("------- PASS THROUGH VOL LINK Optional\n");
#endif
- ret_value = H5VLlink_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLlink_optional(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2509,8 +2430,8 @@ H5VL_pass_through_object_copy(void *src_obj, const H5VL_loc_params_t *src_loc_pa
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_t get_type,
- hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5VL_object_get_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2519,8 +2440,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V
printf("------- PASS THROUGH VOL OBJECT Get\n");
#endif
- ret_value =
- H5VLobject_get(o->under_object, loc_params, o->under_vol_id, get_type, dxpl_id, req, arguments);
+ ret_value = H5VLobject_get(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2541,8 +2461,7 @@ H5VL_pass_through_object_get(void *obj, const H5VL_loc_params_t *loc_params, H5V
*/
static herr_t
H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req,
- va_list arguments)
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
hid_t under_vol_id;
@@ -2552,12 +2471,12 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
printf("------- PASS THROUGH VOL OBJECT Specific\n");
#endif
- // Save copy of underlying VOL connector ID and prov helper, in case of
- // refresh destroying the current object
+ /* Save copy of underlying VOL connector ID, in case of
+ * 'refresh' operation destroying the current object
+ */
under_vol_id = o->under_vol_id;
- ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, specific_type, dxpl_id, req,
- arguments);
+ ret_value = H5VLobject_specific(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2577,8 +2496,8 @@ H5VL_pass_through_object_specific(void *obj, const H5VL_loc_params_t *loc_params
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hid_t dxpl_id, void **req,
- va_list arguments)
+H5VL_pass_through_object_optional(void *obj, const H5VL_loc_params_t *loc_params, H5VL_optional_args_t *args,
+ hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2587,7 +2506,7 @@ H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hi
printf("------- PASS THROUGH VOL OBJECT Optional\n");
#endif
- ret_value = H5VLobject_optional(o->under_object, o->under_vol_id, opt_type, dxpl_id, req, arguments);
+ ret_value = H5VLobject_optional(o->under_object, loc_params, o->under_vol_id, args, dxpl_id, req);
/* Check for async request */
if (req && *req)
@@ -2597,7 +2516,7 @@ H5VL_pass_through_object_optional(void *obj, H5VL_object_optional_t opt_type, hi
} /* end H5VL_pass_through_object_optional() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_introspect_get_conn_clss
+ * Function: H5VL_pass_through_introspect_get_conn_cls
*
* Purpose: Query the connector class.
*
@@ -2627,6 +2546,36 @@ H5VL_pass_through_introspect_get_conn_cls(void *obj, H5VL_get_conn_lvl_t lvl, co
} /* end H5VL_pass_through_introspect_get_conn_cls() */
/*-------------------------------------------------------------------------
+ * Function: H5VL_pass_through_introspect_get_cap_flags
+ *
+ * Purpose: Query the capability flags for this connector and any
+ * underlying connector(s).
+ *
+ * Return: SUCCEED / FAIL
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL_pass_through_introspect_get_cap_flags(const void *_info, unsigned *cap_flags)
+{
+ const H5VL_pass_through_info_t *info = (const H5VL_pass_through_info_t *)_info;
+ herr_t ret_value;
+
+#ifdef ENABLE_PASSTHRU_LOGGING
+ printf("------- PASS THROUGH VOL INTROSPECT GetCapFlags\n");
+#endif
+
+ /* Invoke the query on the underlying VOL connector */
+ ret_value = H5VLintrospect_get_cap_flags(info->under_vol_info, info->under_vol_id, cap_flags);
+
+ /* Bitwise OR our capability flags in */
+ if (ret_value >= 0)
+ *cap_flags |= H5VL_pass_through_g.cap_flags;
+
+ return ret_value;
+} /* end H5VL_pass_through_introspect_get_cap_flags() */
+
+/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_introspect_opt_query
*
* Purpose: Query if an optional operation is supported by this connector
@@ -2743,31 +2692,6 @@ H5VL_pass_through_request_cancel(void *obj, H5VL_request_status_t *status)
} /* end H5VL_pass_through_request_cancel() */
/*-------------------------------------------------------------------------
- * Function: H5VL_pass_through_request_specific_reissue
- *
- * Purpose: Re-wrap vararg arguments into a va_list and reissue the
- * request specific callback to the underlying VOL connector.
- *
- * Return: Success: 0
- * Failure: -1
- *
- *-------------------------------------------------------------------------
- */
-static herr_t
-H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
- H5VL_request_specific_t specific_type, ...)
-{
- va_list arguments;
- herr_t ret_value;
-
- va_start(arguments, specific_type);
- ret_value = H5VLrequest_specific(obj, connector_id, specific_type, arguments);
- va_end(arguments);
-
- return ret_value;
-} /* end H5VL_pass_through_request_specific_reissue() */
-
-/*-------------------------------------------------------------------------
* Function: H5VL_pass_through_request_specific
*
* Purpose: Specific operation on a request
@@ -2778,139 +2702,16 @@ H5VL_pass_through_request_specific_reissue(void *obj, hid_t connector_id,
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_type, va_list arguments)
+H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_args_t *args)
{
- herr_t ret_value = -1;
+ H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
+ herr_t ret_value = -1;
#ifdef ENABLE_PASSTHRU_LOGGING
printf("------- PASS THROUGH VOL REQUEST Specific\n");
#endif
- if (H5VL_REQUEST_WAITANY == specific_type || H5VL_REQUEST_WAITSOME == specific_type ||
- H5VL_REQUEST_WAITALL == specific_type) {
- va_list tmp_arguments;
- size_t req_count;
-
- /* Sanity check */
- assert(obj == NULL);
-
- /* Get enough info to call the underlying connector */
- va_copy(tmp_arguments, arguments);
- req_count = va_arg(tmp_arguments, size_t);
-
- /* Can only use a request to invoke the underlying VOL connector when there's >0 requests */
- if (req_count > 0) {
- void ** req_array;
- void ** under_req_array;
- uint64_t timeout;
- H5VL_pass_through_t *o;
- size_t u; /* Local index variable */
-
- /* Get the request array */
- req_array = va_arg(tmp_arguments, void **);
-
- /* Get a request to use for determining the underlying VOL connector */
- o = (H5VL_pass_through_t *)req_array[0];
-
- /* Create array of underlying VOL requests */
- under_req_array = (void **)malloc(req_count * sizeof(void **));
- for (u = 0; u < req_count; u++)
- under_req_array[u] = ((H5VL_pass_through_t *)req_array[u])->under_object;
-
- /* Remove the timeout value from the vararg list (it's used in all the calls below) */
- timeout = va_arg(tmp_arguments, uint64_t);
-
- /* Release requests that have completed */
- if (H5VL_REQUEST_WAITANY == specific_type) {
- size_t * idx; /* Pointer to the index of completed request */
- H5VL_request_status_t *status; /* Pointer to the request's status */
-
- /* Retrieve the remaining arguments */
- idx = va_arg(tmp_arguments, size_t *);
- assert(*idx <= req_count);
- status = va_arg(tmp_arguments, H5VL_request_status_t *);
-
- /* Reissue the WAITANY 'request specific' call */
- ret_value = H5VL_pass_through_request_specific_reissue(o->under_object, o->under_vol_id,
- specific_type, req_count,
- under_req_array, timeout, idx, status);
-
- /* Release the completed request, if it completed */
- if (ret_value >= 0 && *status != H5ES_STATUS_IN_PROGRESS) {
- H5VL_pass_through_t *tmp_o;
-
- tmp_o = (H5VL_pass_through_t *)req_array[*idx];
- H5VL_pass_through_free_obj(tmp_o);
- } /* end if */
- } /* end if */
- else if (H5VL_REQUEST_WAITSOME == specific_type) {
- size_t * outcount; /* # of completed requests */
- unsigned * array_of_indices; /* Array of indices for completed requests */
- H5VL_request_status_t *array_of_statuses; /* Array of statuses for completed requests */
-
- /* Retrieve the remaining arguments */
- outcount = va_arg(tmp_arguments, size_t *);
- assert(*outcount <= req_count);
- array_of_indices = va_arg(tmp_arguments, unsigned *);
- array_of_statuses = va_arg(tmp_arguments, H5VL_request_status_t *);
-
- /* Reissue the WAITSOME 'request specific' call */
- ret_value = H5VL_pass_through_request_specific_reissue(
- o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout,
- outcount, array_of_indices, array_of_statuses);
-
- /* If any requests completed, release them */
- if (ret_value >= 0 && *outcount > 0) {
- unsigned *idx_array; /* Array of indices of completed requests */
-
- /* Retrieve the array of completed request indices */
- idx_array = va_arg(tmp_arguments, unsigned *);
-
- /* Release the completed requests */
- for (u = 0; u < *outcount; u++) {
- H5VL_pass_through_t *tmp_o;
-
- tmp_o = (H5VL_pass_through_t *)req_array[idx_array[u]];
- H5VL_pass_through_free_obj(tmp_o);
- } /* end for */
- } /* end if */
- } /* end else-if */
- else { /* H5VL_REQUEST_WAITALL == specific_type */
- H5VL_request_status_t *array_of_statuses; /* Array of statuses for completed requests */
-
- /* Retrieve the remaining arguments */
- array_of_statuses = va_arg(tmp_arguments, H5VL_request_status_t *);
-
- /* Reissue the WAITALL 'request specific' call */
- ret_value = H5VL_pass_through_request_specific_reissue(
- o->under_object, o->under_vol_id, specific_type, req_count, under_req_array, timeout,
- array_of_statuses);
-
- /* Release the completed requests */
- if (ret_value >= 0) {
- for (u = 0; u < req_count; u++) {
- if (array_of_statuses[u] != H5ES_STATUS_IN_PROGRESS) {
- H5VL_pass_through_t *tmp_o;
-
- tmp_o = (H5VL_pass_through_t *)req_array[u];
- H5VL_pass_through_free_obj(tmp_o);
- } /* end if */
- } /* end for */
- } /* end if */
- } /* end else */
-
- /* Release array of requests for underlying connector */
- free(under_req_array);
- } /* end if */
-
- /* Finish use of copied vararg list */
- va_end(tmp_arguments);
- } /* end if */
- else {
- H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
-
- ret_value = H5VLrequest_specific(o->under_object, o->under_vol_id, specific_type, arguments);
- } /* end else */
+ ret_value = H5VLrequest_specific(o->under_object, o->under_vol_id, args);
return ret_value;
} /* end H5VL_pass_through_request_specific() */
@@ -2926,7 +2727,7 @@ H5VL_pass_through_request_specific(void *obj, H5VL_request_specific_t specific_t
*-------------------------------------------------------------------------
*/
static herr_t
-H5VL_pass_through_request_optional(void *obj, H5VL_request_optional_t opt_type, va_list arguments)
+H5VL_pass_through_request_optional(void *obj, H5VL_optional_args_t *args)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -2935,7 +2736,7 @@ H5VL_pass_through_request_optional(void *obj, H5VL_request_optional_t opt_type,
printf("------- PASS THROUGH VOL REQUEST Optional\n");
#endif
- ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, opt_type, arguments);
+ ret_value = H5VLrequest_optional(o->under_object, o->under_vol_id, args);
return ret_value;
} /* end H5VL_pass_through_request_optional() */
@@ -3027,8 +2828,7 @@ H5VL_pass_through_blob_get(void *obj, const void *blob_id, void *buf, size_t siz
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t specific_type,
- va_list arguments)
+H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_args_t *args)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -3037,7 +2837,7 @@ H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t s
printf("------- PASS THROUGH VOL BLOB Specific\n");
#endif
- ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id, specific_type, arguments);
+ ret_value = H5VLblob_specific(o->under_object, o->under_vol_id, blob_id, args);
return ret_value;
} /* end H5VL_pass_through_blob_specific() */
@@ -3052,7 +2852,7 @@ H5VL_pass_through_blob_specific(void *obj, void *blob_id, H5VL_blob_specific_t s
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t opt_type, va_list arguments)
+H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_optional_args_t *args)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -3061,7 +2861,7 @@ H5VL_pass_through_blob_optional(void *obj, void *blob_id, H5VL_blob_optional_t o
printf("------- PASS THROUGH VOL BLOB Optional\n");
#endif
- ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, opt_type, arguments);
+ ret_value = H5VLblob_optional(o->under_object, o->under_vol_id, blob_id, args);
return ret_value;
} /* end H5VL_pass_through_blob_optional() */
@@ -3168,7 +2968,7 @@ H5VL_pass_through_token_from_str(void *obj, H5I_type_t obj_type, const char *tok
*-------------------------------------------------------------------------
*/
herr_t
-H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va_list arguments)
+H5VL_pass_through_optional(void *obj, H5VL_optional_args_t *args, hid_t dxpl_id, void **req)
{
H5VL_pass_through_t *o = (H5VL_pass_through_t *)obj;
herr_t ret_value;
@@ -3177,7 +2977,7 @@ H5VL_pass_through_optional(void *obj, int op_type, hid_t dxpl_id, void **req, va
printf("------- PASS THROUGH VOL generic Optional\n");
#endif
- ret_value = H5VLoptional(o->under_object, o->under_vol_id, op_type, dxpl_id, req, arguments);
+ ret_value = H5VLoptional(o->under_object, o->under_vol_id, args, dxpl_id, req);
return ret_value;
} /* end H5VL_pass_through_optional() */
diff --git a/src/H5VLpkg.h b/src/H5VLpkg.h
index 7b8a877..5a4ccc1 100644
--- a/src/H5VLpkg.h
+++ b/src/H5VLpkg.h
@@ -43,6 +43,7 @@
/******************************/
/* Package Private Prototypes */
/******************************/
+H5_DLL herr_t H5VL__set_def_conn(void);
H5_DLL hid_t H5VL__register_connector(const void *cls, hbool_t app_ref, hid_t vipl_id);
H5_DLL hid_t H5VL__register_connector_by_class(const H5VL_class_t *cls, hbool_t app_ref, hid_t vipl_id);
H5_DLL hid_t H5VL__register_connector_by_name(const char *name, hbool_t app_ref, hid_t vipl_id);
@@ -56,5 +57,16 @@ H5_DLL hid_t H5VL__peek_connector_id_by_name(const char *name);
H5_DLL hid_t H5VL__peek_connector_id_by_value(H5VL_class_value_t value);
H5_DLL herr_t H5VL__connector_str_to_info(const char *str, hid_t connector_id, void **info);
H5_DLL ssize_t H5VL__get_connector_name(hid_t id, char *name /*out*/, size_t size);
+H5_DLL void H5VL__is_default_conn(hid_t fapl_id, hid_t connector_id, hbool_t *is_default);
+H5_DLL herr_t H5VL__register_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL size_t H5VL__num_opt_operation(void);
+H5_DLL herr_t H5VL__find_opt_operation(H5VL_subclass_t subcls, const char *op_name, int *op_val);
+H5_DLL herr_t H5VL__unregister_opt_operation(H5VL_subclass_t subcls, const char *op_name);
+H5_DLL herr_t H5VL__term_opt_operation(void);
+
+/* Testing functions */
+#ifdef H5VL_TESTING
+H5_DLL herr_t H5VL__reparse_def_vol_conn_variable_test(void);
+#endif /* H5VL_TESTING */
#endif /* H5VLpkg_H */
diff --git a/src/H5VLprivate.h b/src/H5VLprivate.h
index 34fb13d..f929d03 100644
--- a/src/H5VLprivate.h
+++ b/src/H5VLprivate.h
@@ -16,6 +16,11 @@
/* Include package's public header */
#include "H5VLpublic.h" /* Generic Functions */
+/* Include connector author public header(s) */
+#include "H5VLconnector.h" /* VOL connector author routines */
+#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
+#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
+
/* Private headers needed by this file */
/**************************/
@@ -61,13 +66,15 @@ typedef enum H5VL_get_connector_kind_t {
/******************************/
/* Utility functions */
-H5_DLL herr_t H5VL_init_phase1(void);
-H5_DLL herr_t H5VL_init_phase2(void);
+H5_DLL herr_t H5VL_init_phase1(void);
+H5_DLL herr_t H5VL_init_phase2(void);
+H5_DLL H5VL_t *H5VL_new_connector(hid_t connector_id);
H5_DLL herr_t H5VL_cmp_connector_cls(int *cmp_value, const H5VL_class_t *cls1, const H5VL_class_t *cls2);
H5_DLL herr_t H5VL_conn_copy(H5VL_connector_prop_t *value);
H5_DLL int64_t H5VL_conn_inc_rc(H5VL_t *connector);
H5_DLL int64_t H5VL_conn_dec_rc(H5VL_t *connector);
H5_DLL herr_t H5VL_conn_free(const H5VL_connector_prop_t *info);
+H5_DLL herr_t H5VL_get_cap_flags(const H5VL_connector_prop_t *prop, unsigned *cap_flags);
/* Functions that deal with VOL connectors */
union H5PL_key_t;
@@ -109,8 +116,9 @@ H5_DLL herr_t H5VL_reset_vol_wrapper(void);
/* Library state functions */
H5_DLL herr_t H5VL_retrieve_lib_state(void **state);
+H5_DLL herr_t H5VL_start_lib_state(void);
H5_DLL herr_t H5VL_restore_lib_state(const void *state);
-H5_DLL herr_t H5VL_reset_lib_state(void);
+H5_DLL herr_t H5VL_finish_lib_state(void);
H5_DLL herr_t H5VL_free_lib_state(void *state);
/* ID registration functions */
@@ -127,12 +135,11 @@ H5_DLL herr_t H5VL_setup_loc_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_lo
H5_DLL herr_t H5VL_setup_acc_args(hid_t loc_id, const struct H5P_libclass_t *libclass, hbool_t is_collective,
hid_t *acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
H5_DLL herr_t H5VL_setup_self_args(hid_t loc_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
-H5_DLL herr_t H5VL_setup_name_args(hid_t loc_id, const char *name, const struct H5P_libclass_t *libclass,
- hbool_t is_collective, hid_t acspl_id, H5VL_object_t **vol_obj,
- H5VL_loc_params_t *loc_params);
+H5_DLL herr_t H5VL_setup_name_args(hid_t loc_id, const char *name, hbool_t is_collective, hid_t lapl_id,
+ H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
H5_DLL herr_t H5VL_setup_idx_args(hid_t loc_id, const char *name, H5_index_t idx_type, H5_iter_order_t order,
- hsize_t n, const struct H5P_libclass_t *libclass, hbool_t is_collective,
- hid_t acspl_id, H5VL_object_t **vol_obj, H5VL_loc_params_t *loc_params);
+ hsize_t n, hbool_t is_collective, hid_t lapl_id, H5VL_object_t **vol_obj,
+ H5VL_loc_params_t *loc_params);
H5_DLL herr_t H5VL_setup_token_args(hid_t loc_id, H5O_token_t *obj_token, H5VL_object_t **vol_obj,
H5VL_loc_params_t *loc_params);
@@ -156,12 +163,12 @@ H5_DLL herr_t H5VL_attr_read(const H5VL_object_t *vol_obj, hid_t dtype_id, void
void **req);
H5_DLL herr_t H5VL_attr_write(const H5VL_object_t *vol_obj, hid_t dtype_id, const void *buf, hid_t dxpl_id,
void **req);
-H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_t get_type, hid_t dxpl_id, void **req,
- ...);
+H5_DLL herr_t H5VL_attr_get(const H5VL_object_t *vol_obj, H5VL_attr_get_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_attr_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_attr_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_attr_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+ H5VL_attr_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_attr_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_attr_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Dataset functions */
@@ -174,12 +181,12 @@ H5_DLL herr_t H5VL_dataset_read(const H5VL_object_t *vol_obj, hid_t mem_type_id,
hid_t file_space_id, hid_t dxpl_id, void *buf, void **req);
H5_DLL herr_t H5VL_dataset_write(const H5VL_object_t *vol_obj, hid_t mem_type_id, hid_t mem_space_id,
hid_t file_space_id, hid_t dxpl_id, const void *buf, void **req);
-H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_t get_type, hid_t dxpl_id,
- void **req, ...);
-H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_dataset_optional_t opt_type,
- hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_dataset_get(const H5VL_object_t *vol_obj, H5VL_dataset_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_dataset_specific(const H5VL_object_t *cls, H5VL_dataset_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_dataset_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_dataset_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Datatype functions */
@@ -188,12 +195,14 @@ H5_DLL void * H5VL_datatype_commit(const H5VL_object_t *vol_obj, const H5VL_loc_
hid_t tapl_id, hid_t dxpl_id, void **req);
H5_DLL void * H5VL_datatype_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t tapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_t get_type, hid_t dxpl_id,
- void **req, ...);
-H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_datatype_optional_t opt_type,
- hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_datatype_get(const H5VL_object_t *vol_obj, H5VL_datatype_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_datatype_specific(const H5VL_object_t *vol_obj, H5VL_datatype_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_datatype_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_datatype_optional_op(H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req, H5VL_object_t **vol_obj_ptr);
H5_DLL herr_t H5VL_datatype_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* File functions */
@@ -201,12 +210,12 @@ H5_DLL void * H5VL_file_create(const H5VL_connector_prop_t *connector_prop, cons
hid_t fcpl_id, hid_t fapl_id, hid_t dxpl_id, void **req);
H5_DLL void * H5VL_file_open(H5VL_connector_prop_t *connector_prop, const char *name, unsigned flags,
hid_t fapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_t get_type, hid_t dxpl_id, void **req,
- ...);
-H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_file_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+H5_DLL herr_t H5VL_file_get(const H5VL_object_t *vol_obj, H5VL_file_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_file_specific(const H5VL_object_t *vol_obj, H5VL_file_specific_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_file_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_file_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Group functions */
@@ -215,18 +224,18 @@ H5_DLL void * H5VL_group_create(const H5VL_object_t *vol_obj, const H5VL_loc_par
void **req);
H5_DLL void * H5VL_group_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
const char *name, hid_t gapl_id, hid_t dxpl_id, void **req);
-H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_t get_type, hid_t dxpl_id,
- void **req, ...);
-H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_t specific_type,
- hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_group_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+H5_DLL herr_t H5VL_group_get(const H5VL_object_t *vol_obj, H5VL_group_get_args_t *args, hid_t dxpl_id,
+ void **req);
+H5_DLL herr_t H5VL_group_specific(const H5VL_object_t *vol_obj, H5VL_group_specific_args_t *args,
+ hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_group_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
H5_DLL herr_t H5VL_group_close(const H5VL_object_t *vol_obj, hid_t dxpl_id, void **req);
/* Link functions */
-H5_DLL herr_t H5VL_link_create(H5VL_link_create_type_t create_type, const H5VL_object_t *vol_obj,
+H5_DLL herr_t H5VL_link_create(H5VL_link_create_args_t *args, const H5VL_object_t *vol_obj,
const H5VL_loc_params_t *loc_params, hid_t lcpl_id, hid_t lapl_id,
- hid_t dxpl_id, void **req, ...);
+ hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_copy(const H5VL_object_t *src_vol_obj, const H5VL_loc_params_t *loc_params1,
const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
@@ -234,11 +243,11 @@ H5_DLL herr_t H5VL_link_move(const H5VL_object_t *src_vol_obj, const H5VL_loc_pa
const H5VL_object_t *dst_vol_obj, const H5VL_loc_params_t *loc_params2,
hid_t lcpl_id, hid_t lapl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_get_t get_type, hid_t dxpl_id, void **req, ...);
+ H5VL_link_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_link_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_link_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, H5VL_link_optional_t opt_type, hid_t dxpl_id,
- void **req, ...);
+ H5VL_link_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_link_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Object functions */
H5_DLL void * H5VL_object_open(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *params,
@@ -248,15 +257,16 @@ H5_DLL herr_t H5VL_object_copy(const H5VL_object_t *src_obj, const H5VL_loc_para
const H5VL_loc_params_t *dst_loc_params, const char *dst_name, hid_t ocpypl_id,
hid_t lcpl_id, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_object_get(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_get_t get_type, hid_t dxpl_id, void **req, ...);
+ H5VL_object_get_args_t *args, hid_t dxpl_id, void **req);
H5_DLL herr_t H5VL_object_specific(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
- H5VL_object_specific_t specific_type, hid_t dxpl_id, void **req, ...);
-H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, H5VL_object_optional_t opt_type,
- hid_t dxpl_id, void **req, ...);
+ H5VL_object_specific_args_t *args, hid_t dxpl_id, void **req);
+H5_DLL herr_t H5VL_object_optional(const H5VL_object_t *vol_obj, const H5VL_loc_params_t *loc_params,
+ H5VL_optional_args_t *args, hid_t dxpl_id, void **req);
/* Connector/container introspection functions */
H5_DLL herr_t H5VL_introspect_get_conn_cls(const H5VL_object_t *vol_obj, H5VL_get_conn_lvl_t lvl,
const H5VL_class_t **conn_cls);
+H5_DLL herr_t H5VL_introspect_get_cap_flags(const void *info, const H5VL_class_t *cls, unsigned *cap_flags);
H5_DLL herr_t H5VL_introspect_opt_query(const H5VL_object_t *vol_obj, H5VL_subclass_t subcls, int opt_type,
uint64_t *flags);
@@ -265,8 +275,8 @@ H5_DLL herr_t H5VL_request_wait(const H5VL_object_t *vol_obj, uint64_t timeout,
H5VL_request_status_t *status);
H5_DLL herr_t H5VL_request_notify(const H5VL_object_t *vol_obj, H5VL_request_notify_t cb, void *ctx);
H5_DLL herr_t H5VL_request_cancel(const H5VL_object_t *vol_obj, H5VL_request_status_t *status);
-H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_t specific_type, ...);
-H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_request_optional_t opt_type, ...);
+H5_DLL herr_t H5VL_request_specific(const H5VL_object_t *vol_obj, H5VL_request_specific_args_t *args);
+H5_DLL herr_t H5VL_request_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args);
H5_DLL herr_t H5VL_request_free(const H5VL_object_t *vol_obj);
/* Blob functions */
@@ -275,9 +285,8 @@ H5_DLL herr_t H5VL_blob_put(const H5VL_object_t *vol_obj, const void *buf, size_
H5_DLL herr_t H5VL_blob_get(const H5VL_object_t *vol_obj, const void *blob_id, void *buf, size_t size,
void *ctx);
H5_DLL herr_t H5VL_blob_specific(const H5VL_object_t *vol_obj, void *blob_id,
- H5VL_blob_specific_t specific_type, ...);
-H5_DLL herr_t H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_blob_optional_t opt_type,
- ...);
+ H5VL_blob_specific_args_t *args);
+H5_DLL herr_t H5VL_blob_optional(const H5VL_object_t *vol_obj, void *blob_id, H5VL_optional_args_t *args);
/* Token functions */
H5_DLL herr_t H5VL_token_cmp(const H5VL_object_t *vol_obj, const H5O_token_t *token1,
@@ -288,6 +297,7 @@ H5_DLL herr_t H5VL_token_from_str(const H5VL_object_t *vol_obj, H5I_type_t obj_t
H5O_token_t *token);
/* Generic functions */
-H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, int op_type, hid_t dxpl_id, void **req, ...);
+H5_DLL herr_t H5VL_optional(const H5VL_object_t *vol_obj, H5VL_optional_args_t *args, hid_t dxpl_id,
+ void **req);
#endif /* H5VLprivate_H */
diff --git a/src/H5VLpublic.h b/src/H5VLpublic.h
index c5f85dc..543c3c8 100644
--- a/src/H5VLpublic.h
+++ b/src/H5VLpublic.h
@@ -116,6 +116,9 @@ typedef enum H5VL_subclass_t {
H5VL_SUBCLS_REQUEST, /**< 'Request' subclass */
H5VL_SUBCLS_BLOB, /**< 'Blob' subclass */
H5VL_SUBCLS_TOKEN /**< 'Token' subclass */
+ /* NOTE: if more operations are added, the
+ * H5VL_opt_vals_g[] array size should be updated.
+ */
} H5VL_subclass_t;
/********************/
@@ -353,14 +356,22 @@ H5_DLL herr_t H5VLunregister_connector(hid_t connector_id);
* \since 1.12.0
*/
H5_DLL herr_t H5VLquery_optional(hid_t obj_id, H5VL_subclass_t subcls, int opt_type, uint64_t *flags);
+/**
+ * \ingroup H5VL
+ * \brief Determines whether an object ID represents a native
+ * VOL connector object.
+ *
+ * \param[in] obj_id Object identifier
+ * \param[in] is_native Boolean determining whether object is a native
+ * VOL connector object
+ * \return \herr_t
+ *
+ * \since 1.13.0
+ */
+H5_DLL herr_t H5VLobject_is_native(hid_t obj_id, hbool_t *is_native);
#ifdef __cplusplus
}
#endif
-/* Semi-public headers mainly for VOL connector authors */
-#include "H5VLconnector.h" /* VOL connector author routines */
-#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
-#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
-
#endif /* H5VLpublic_H */
diff --git a/src/H5VLtest.c b/src/H5VLtest.c
new file mode 100644
index 0000000..1f99ce5
--- /dev/null
+++ b/src/H5VLtest.c
@@ -0,0 +1,96 @@
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ * Copyright by The HDF Group. *
+ * All rights reserved. *
+ * *
+ * This file is part of HDF5. The full HDF5 copyright notice, including *
+ * terms governing use, modification, and redistribution, is contained in *
+ * the COPYING file, which can be found at the root of the source code *
+ * distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases. *
+ * If you do not have access to either file, you may request a copy from *
+ * help@hdfgroup.org. *
+ * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
+
+/*-------------------------------------------------------------------------
+ *
+ * Created: H5VLtest.c
+ * Jan 3 2021
+ * Quincey Koziol
+ *
+ * Purpose: Virtual Object Layer (VOL) testing routines.
+ *
+ *-------------------------------------------------------------------------
+ */
+
+/****************/
+/* Module Setup */
+/****************/
+
+#include "H5VLmodule.h" /* This source code file is part of the H5VL module */
+#define H5VL_TESTING /* Suppress warning about H5VL testing funcs */
+
+/***********/
+/* Headers */
+/***********/
+#include "H5private.h" /* Generic Functions */
+#include "H5Eprivate.h" /* Error handling */
+#include "H5VLpkg.h" /* Virtual Object Layer */
+
+/****************/
+/* Local Macros */
+/****************/
+
+/******************/
+/* Local Typedefs */
+/******************/
+
+/********************/
+/* Package Typedefs */
+/********************/
+
+/********************/
+/* Local Prototypes */
+/********************/
+
+/*********************/
+/* Package Variables */
+/*********************/
+
+/*****************************/
+/* Library Private Variables */
+/*****************************/
+
+/*******************/
+/* Local Variables */
+/*******************/
+
+/*-------------------------------------------------------------------------
+ * Function: H5VL__reparse_def_vol_conn_variable_test
+ *
+ * Purpose: Re-parse the default VOL connector environment variable.
+ *
+ * Since getenv(3) is fairly expensive, we only parse it once,
+ * when the library opens. This test function is used to
+ * re-parse the environment variable after we've changed it
+ * with setenv(3).
+ *
+ * Return: SUCCEED/FAIL
+ *
+ * Programmer: Quincey Koziol
+ * Feb 3, 2021
+ *
+ *-------------------------------------------------------------------------
+ */
+herr_t
+H5VL__reparse_def_vol_conn_variable_test(void)
+{
+ herr_t ret_value = SUCCEED;
+
+ FUNC_ENTER_PACKAGE
+
+ /* Re-check for the HDF5_VOL_CONNECTOR environment variable */
+ if (H5VL__set_def_conn() < 0)
+ HGOTO_ERROR(H5E_VOL, H5E_CANTINIT, FAIL, "unable to initialize default VOL connector")
+
+done:
+ FUNC_LEAVE_NOAPI(ret_value)
+} /* end H5VL__reparse_def_vol_conn_variable_test() */
diff --git a/src/H5Zmodule.h b/src/H5Zmodule.h
index 76a2380..9312b72 100644
--- a/src/H5Zmodule.h
+++ b/src/H5Zmodule.h
@@ -29,57 +29,80 @@
#define H5_MY_PKG_ERR H5E_PLINE
#define H5_MY_PKG_INIT YES
-/**
- * \defgroup H5Z H5Z
+/**\defgroup H5Z H5Z
*
+ * Use the functions in this module to manage HDF5 filters.
*
- * \brief Filter and Compression Interface
+ * User-defined filters are created by registering a filter descriptor of
+ * type #H5Z_class_t with the library.
*
- * \details The functions in this module let you configure filters that process
- * data during I/O operation.
+ * Available filters can be read or examined at runtime.
*
- * HDF5 supports a filter pipeline that provides the capability for
- * standard and customized raw data processing during I/O operations.
- * HDF5 is distributed with a small set of standard filters such as
- * compression (gzip, SZIP, and a shuffling algorithm) and error
- * checking (Fletcher32 checksum). For further flexibility, the
- * library allows a user application to extend the pipeline through
- * the creation and registration of customized filters.
+ * It is conceivable that filters are stateful and that that state be
+ * updated at runtime.
*
- * The flexibility of the filter pipeline implementation enables the
- * definition of additional filters by a user application. A filter
- * \li is associated with a dataset when the dataset is created,
- * \li can be used only with chunked data (i.e., datasets stored in
- * the #H5D_CHUNKED storage layout), and
- * \li is applied independently to each chunk of the dataset.
+ * Filters are deleted by unregistering.
*
- * The HDF5 library does not support filters for contiguous datasets
- * because of the difficulty of implementing random access for partial
- * I/O. Compact dataset filters are not supported because it would not
- * produce significant results.
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5Z_examples.c filter
+ * \snippet{lineno} H5Z_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5Z_examples.c read
+ * </td>
+ * </tr>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5Z_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5Z_examples.c delete
+ * </tr>
+ * </table>
*
- * Filter identifiers for the filters distributed with the HDF5
- * Library are as follows:
- * <table>
- * <tr><td>#H5Z_FILTER_DEFLATE</td><td>The gzip compression, or
- * deflation, filter</td></tr>
- * <tr><td>#H5Z_FILTER_SZIP</td><td>The SZIP compression
- * filter</td></tr>
- * <tr><td>#H5Z_FILTER_NBIT</td><td>The N-bit compression
- * filter</td></tr>
- * <tr><td>#H5Z_FILTER_SCALEOFFSET</td><td>The scale-offset
- * compression filter</td></tr>
- * <tr><td>#H5Z_FILTER_SHUFFLE</td><td>The shuffle algorithm
- * filter</td></tr>
- * <tr><td>#H5Z_FILTER_FLETCHER32</td><td>The Fletcher32 checksum,
- * or error checking, filter</td></tr>
- * </table>
- * Custom filters that have been registered with the library will have
- * additional unique identifiers.
+ * HDF5 supports a filter pipeline that provides the capability for standard and
+ * customized raw data processing during I/O operations. HDF5 is distributed
+ * with a small set of standard filters such as compression (gzip, SZIP, and a
+ * shuffling algorithm) and error checking (Fletcher32 checksum). For further
+ * flexibility, the library allows a user application to extend the pipeline
+ * through the creation and registration of customized filters.
*
- * See \ref_dld_filters for more information on how an HDF5
- * application can apply a filter that is not registered with the HDF5
- * library.
+ * The flexibility of the filter pipeline implementation enables the definition
+ * of additional filters by a user application. A filter
+ * \li is associated with a dataset when the dataset is created,
+ * \li can be used only with chunked data (i.e., datasets stored in the
+ * #H5D_CHUNKED storage layout), and
+ * \li is applied independently to each chunk of the dataset.
+ *
+ * The HDF5 library does not support filters for contiguous datasets because of
+ * the difficulty of implementing random access for partial I/O. Compact dataset
+ * filters are not supported because it would not produce significant results.
+ *
+ * Filter identifiers for the filters distributed with the HDF5
+ * Library are as follows:
+ * <table>
+ * <tr><td>#H5Z_FILTER_DEFLATE</td><td>The gzip compression, or
+ * deflation, filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SZIP</td><td>The SZIP compression
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_NBIT</td><td>The N-bit compression
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SCALEOFFSET</td><td>The scale-offset
+ * compression filter</td></tr>
+ * <tr><td>#H5Z_FILTER_SHUFFLE</td><td>The shuffle algorithm
+ * filter</td></tr>
+ * <tr><td>#H5Z_FILTER_FLETCHER32</td><td>The Fletcher32 checksum,
+ * or error checking, filter</td></tr>
+ * </table>
+ * Custom filters that have been registered with the library will have
+ * additional unique identifiers.
+ *
+ * See \ref_dld_filters for more information on how an HDF5 application can
+ * apply a filter that is not registered with the HDF5 library.
*
* \defgroup H5ZPRE Predefined Filters
* \ingroup H5Z
diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c
index 2e1a474..48a29cd 100644
--- a/src/H5Zscaleoffset.c
+++ b/src/H5Zscaleoffset.c
@@ -364,12 +364,12 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
#define H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \
{ \
i = 0; \
- while (i < d_nelmts && HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \
+ while (i < d_nelmts && HDfabs((double)(buf[i] - filval)) < HDpow(10.0, -D_val)) \
i++; \
if (i < d_nelmts) \
min = max = buf[i]; \
for (; i < d_nelmts; i++) { \
- if (HDfabs(buf[i] - filval) < HDpow(10.0, -D_val)) \
+ if (HDfabs((double)(buf[i] - filval)) < HDpow(10.0, -D_val)) \
continue; /* ignore fill value */ \
if (buf[i] > max) \
max = buf[i]; \
@@ -425,22 +425,22 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
#define H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) \
{ \
if (sizeof(type) == sizeof(int)) { \
- if (round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) > \
- pow_fun(2.0f, (type)(sizeof(int) * 8 - 1))) { \
+ if (round_fun(max * pow_fun((type)10, (type)D_val) - min * pow_fun((type)10, (type)D_val)) > \
+ pow_fun((type)2, (type)(sizeof(int) * 8 - 1))) { \
*minbits = sizeof(int) * 8; \
goto done; \
} \
} \
else if (sizeof(type) == sizeof(long)) { \
- if (round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) > \
- pow_fun(2.0f, (type)(sizeof(long) * 8 - 1))) { \
+ if (round_fun(max * pow_fun((type)10, (type)D_val) - min * pow_fun((type)10, (type)D_val)) > \
+ pow_fun((type)2, (type)(sizeof(long) * 8 - 1))) { \
*minbits = sizeof(long) * 8; \
goto done; \
} \
} \
else if (sizeof(type) == sizeof(long long)) { \
- if (round_fun(max * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)) > \
- pow_fun(2.0f, (type)(sizeof(long long) * 8 - 1))) { \
+ if (round_fun(max * pow_fun((type)10, (type)D_val) - min * pow_fun((type)10, (type)D_val)) > \
+ pow_fun((type)2, (type)(sizeof(long long) * 8 - 1))) { \
*minbits = sizeof(long long) * 8; \
goto done; \
} \
@@ -530,27 +530,27 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun((type)10, (type)-D_val)) \
*(int *)((void *)&buf[i]) = (int)(((unsigned int)1 << *minbits) - 1); \
else \
- *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
} \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun((type)10, (type)-D_val)) \
*(long *)((void *)&buf[i]) = (long)(((unsigned long)1 << *minbits) - 1); \
else \
- *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
} \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) { \
- if (abs_fun(buf[i] - filval) < pow_fun(10.0f, (type)-D_val)) \
+ if (abs_fun(buf[i] - filval) < pow_fun((type)10, (type)-D_val)) \
*(long long *)((void *)&buf[i]) = (long long)(((unsigned long long)1 << *minbits) - 1); \
else \
- *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
} \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
@@ -561,16 +561,16 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) \
- *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)); \
+ *(int *)((void *)&buf[i]) = (int)lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
- *(long *)((void *)&buf[i]) = \
- lround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \
+ *(long *)((void *)&buf[i]) = lround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
- *(long long *)((void *)&buf[i]) = \
- llround_fun(buf[i] * pow_fun(10.0f, (type)D_val) - min * pow_fun(10.0f, (type)D_val)); \
+ *(long long *)((void *)&buf[i]) = llround_fun(buf[i] * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
@@ -606,8 +606,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
H5Z_scaleoffset_get_filval_2(type, cd_values, filval) \
H5Z_scaleoffset_max_min_3(i, d_nelmts, buf, filval, max, min, D_val) \
H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \
- (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)) + \
+ (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)) + \
1); \
*minbits = H5Z__scaleoffset_log2(span + 1); \
if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \
@@ -617,8 +617,8 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
else { /* fill value undefined */ \
H5Z_scaleoffset_max_min_2(i, d_nelmts, buf, max, min) \
H5Z_scaleoffset_check_3(i, type, pow_fun, round_fun, max, min, minbits, D_val) span = \
- (unsigned long long)(llround_fun(max * pow_fun(10.0f, (type)D_val) - \
- min * pow_fun(10.0f, (type)D_val)) + \
+ (unsigned long long)(llround_fun(max * pow_fun((type)10, (type)D_val) - \
+ min * pow_fun((type)10, (type)D_val)) + \
1); \
*minbits = H5Z__scaleoffset_log2(span); \
if (*minbits != sizeof(type) * 8) /* change values if minbits != full precision */ \
@@ -685,19 +685,19 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
buf[i] = \
(type)((*(int *)((void *)&buf[i]) == (int)(((unsigned int)1 << minbits) - 1)) \
? filval \
- : (type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ : (type)(*(int *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
buf[i] = \
(type)((*(long *)((void *)&buf[i]) == (long)(((unsigned long)1 << minbits) - 1)) \
? filval \
- : (type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ : (type)(*(long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
buf[i] = (type)( \
(*(long long *)((void *)&buf[i]) == (long long)(((unsigned long long)1 << minbits) - 1)) \
? filval \
- : (type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ : (type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
@@ -707,13 +707,13 @@ H5Z_class2_t H5Z_SCALEOFFSET[1] = {{
{ \
if (sizeof(type) == sizeof(int)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ buf[i] = ((type)(*(int *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ buf[i] = ((type)(*(long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else if (sizeof(type) == sizeof(long long)) \
for (i = 0; i < d_nelmts; i++) \
- buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun(10.0f, (type)D_val) + min); \
+ buf[i] = ((type)(*(long long *)((void *)&buf[i])) / pow_fun((type)10, (type)D_val) + min); \
else \
HGOTO_ERROR(H5E_PLINE, H5E_BADTYPE, FAIL, "cannot find matched integer dataype") \
}
diff --git a/src/H5Ztrans.c b/src/H5Ztrans.c
index 7d55efd..ea532cf 100644
--- a/src/H5Ztrans.c
+++ b/src/H5Ztrans.c
@@ -150,7 +150,6 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree);
HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "Unexpected type conversion operation") \
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
#if CHAR_MIN >= 0
#define H5Z_XFORM_TYPE_OP(RESL, RESR, TYPE, OP, SIZE) \
{ \
@@ -212,65 +211,6 @@ static void H5Z__xform_reduce_tree(H5Z_node *tree);
H5Z_XFORM_DO_OP1((RESL), (RESR), long double, OP, (SIZE)) \
}
#endif /* CHAR_MIN >= 0 */
-#else
-#if CHAR_MIN >= 0
-#define H5Z_XFORM_TYPE_OP(RESL, RESR, TYPE, OP, SIZE) \
- { \
- if ((TYPE) == H5T_NATIVE_CHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_SCHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), signed char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_SHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_USHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_INT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_UINT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_FLOAT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_DOUBLE) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), double, OP, (SIZE)) \
- }
-#else /* CHAR_MIN >= 0 */
-#define H5Z_XFORM_TYPE_OP(RESL, RESR, TYPE, OP, SIZE) \
- { \
- if ((TYPE) == H5T_NATIVE_CHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_UCHAR) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned char, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_SHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_USHORT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned short, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_INT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_UINT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned int, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_LLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_ULLONG) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), unsigned long long, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_FLOAT) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), float, OP, (SIZE)) \
- else if ((TYPE) == H5T_NATIVE_DOUBLE) \
- H5Z_XFORM_DO_OP1((RESL), (RESR), double, OP, (SIZE)) \
- }
-#endif /* CHAR_MIN >= 0 */
-#endif /*H5_SIZEOF_LONG_DOUBLE */
#define H5Z_XFORM_DO_OP3(OP) \
{ \
@@ -1056,10 +996,8 @@ H5Z_xform_eval(H5Z_data_xform_t *data_xform_prop, void *array, size_t array_size
H5Z_XFORM_DO_OP5(float, array_size)
else if (array_type == H5T_NATIVE_DOUBLE)
H5Z_XFORM_DO_OP5(double, array_size)
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (array_type == H5T_NATIVE_LDOUBLE)
H5Z_XFORM_DO_OP5(long double, array_size)
-#endif
} /* end if */
/* Otherwise, do the full data transform */
@@ -1267,11 +1205,9 @@ H5Z__xform_find_type(const H5T_t *type)
/* Check for DOUBLE type */
else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_DOUBLE)) && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_DOUBLE)
-#if H5_SIZEOF_LONG_DOUBLE != 0
/* Check for LONGDOUBLE type */
else if ((tmp = (H5T_t *)H5I_object(H5T_NATIVE_LDOUBLE)) && 0 == H5T_cmp(type, tmp, FALSE))
HGOTO_DONE(H5T_NATIVE_LDOUBLE)
-#endif
else
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "could not find matching type")
@@ -1547,11 +1483,11 @@ H5Z_xform_create(const char *expr)
(HDisdigit(expr[i - 1]) || (expr[i - 1] == '.')) &&
(HDisdigit(expr[i + 1]) || (expr[i + 1] == '-') || (expr[i + 1] == '+')))
continue;
- }
+ } /* end if */
count++;
- }
- }
+ } /* end if */
+ } /* end for */
/* When there are no "x"'s in the equation (ie, simple transform case),
* we don't need to allocate any space since no array will have to be
@@ -1749,11 +1685,19 @@ done:
hbool_t
H5Z_xform_noop(const H5Z_data_xform_t *data_xform_prop)
{
- hbool_t ret_value = FALSE; /* Return value */
+ hbool_t ret_value = TRUE; /* Return value */
FUNC_ENTER_NOAPI_NOINIT_NOERR
- ret_value = (data_xform_prop ? FALSE : TRUE);
+ if (data_xform_prop) {
+ ret_value = FALSE;
+
+ /* Check for trivial data tranformation: expression = "x" */
+ if ((HDstrlen(data_xform_prop->xform_exp) == 1) && data_xform_prop->dat_val_pointers &&
+ (data_xform_prop->dat_val_pointers->num_ptrs == 1)) {
+ ret_value = TRUE;
+ } /* end if */
+ } /* end if */
FUNC_LEAVE_NOAPI(ret_value)
} /* H5Z_xform_noop() */
diff --git a/src/H5detect.c b/src/H5detect.c
index 2e893cf..022cb55 100644
--- a/src/H5detect.c
+++ b/src/H5detect.c
@@ -52,7 +52,7 @@ static const char *FileHeader = "\n\
/* Disable warning about cast increasing the alignment of the target type,
* that's _exactly_ what this code is probing. -QAK
*/
-H5_GCC_DIAG_OFF("cast-align")
+H5_GCC_CLANG_DIAG_OFF("cast-align")
#if defined(__has_attribute)
#if __has_attribute(no_sanitize_address)
@@ -300,10 +300,10 @@ precision(detected_t *d)
for (_byte_mask = (unsigned char)1; _byte_mask; _byte_mask = (unsigned char)(_byte_mask << 1)) { \
_buf1[_i] ^= _byte_mask; \
HDmemcpy((void *)&_v2, (const void *)_buf1, sizeof(TYPE)); \
- H5_GCC_DIAG_OFF("float-equal") \
+ H5_GCC_CLANG_DIAG_OFF("float-equal") \
if (_v1 != _v2) \
_pad_mask[_i] |= _byte_mask; \
- H5_GCC_DIAG_ON("float-equal") \
+ H5_GCC_CLANG_DIAG_ON("float-equal") \
_buf1[_i] ^= _byte_mask; \
} /* end for */ \
\
@@ -414,10 +414,10 @@ precision(detected_t *d)
HDmemcpy(_buf + align_g[_ano] + (INFO.offset / 8), ((char *)&_val) + (INFO.offset / 8), \
(size_t)(INFO.precision / 8)); \
_val2 = *((TYPE *)(_buf + align_g[_ano])); \
- H5_GCC_DIAG_OFF("float-equal") \
+ H5_GCC_CLANG_DIAG_OFF("float-equal") \
if (_val != _val2) \
H5LONGJMP(jbuf_g, 1); \
- H5_GCC_DIAG_ON("float-equal") \
+ H5_GCC_CLANG_DIAG_ON("float-equal") \
/* End Cray Check */ \
(INFO.align) = align_g[_ano]; \
} \
@@ -1412,7 +1412,7 @@ detect_C99_floats(void)
*/
DETECT_F(double, LDOUBLE, d_g[nd_g]);
nd_g++;
-#elif H5_SIZEOF_LONG_DOUBLE != 0
+#else
DETECT_F(long double, LDOUBLE, d_g[nd_g]);
nd_g++;
#endif
@@ -1567,4 +1567,4 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
}
-H5_GCC_DIAG_ON("cast-align")
+H5_GCC_CLANG_DIAG_ON("cast-align")
diff --git a/src/H5module.h b/src/H5module.h
index 64081bf..6d3cba8 100644
--- a/src/H5module.h
+++ b/src/H5module.h
@@ -27,8 +27,31 @@
#define H5_MY_PKG_INIT YES
/**\defgroup H5 H5
- * \brief General Library Functions
- * \todo Describe concisely what the functions in this module are about.
+ *
+ * Use the functions in this module to manage the life cycle of HDF5 library
+ * instances.
+ *
+ * <table>
+ * <tr><th>Create</th><th>Read</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5_examples.c create
+ * </td>
+ * <td>
+ * \snippet{lineno} H5_examples.c read
+ * </td>
+ * <tr><th>Update</th><th>Delete</th></tr>
+ * <tr valign="top">
+ * <td>
+ * \snippet{lineno} H5_examples.c update
+ * </td>
+ * <td>
+ * \snippet{lineno} H5_examples.c closing_shop
+ * \snippet{lineno} H5_examples.c delete
+ * </td>
+ * </tr>
+ * </table>
+ *
*/
#endif /* H5module_H */
diff --git a/src/H5mpi.c b/src/H5mpi.c
index 9749721..4a8aa44 100644
--- a/src/H5mpi.c
+++ b/src/H5mpi.c
@@ -523,7 +523,7 @@ H5_mpio_create_large_type(hsize_t num_elements, MPI_Aint stride_bytes, MPI_Datat
MPI_Type_get_extent(old_type, &unused_lb_arg, &old_extent);
}
- /* Set up the arguments for MPI_Type_struct constructor */
+ /* Set up the arguments for MPI_Type_create_struct() */
type[0] = outer_type;
type[1] = leftover_type;
block_len[0] = 1;
diff --git a/src/H5private.h b/src/H5private.h
index bb416ef..761ad17 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -44,7 +44,9 @@
#include <sys/time.h>
#endif
#ifdef H5_HAVE_UNISTD_H
+#ifdef H5_HAVE_PWD_H
#include <pwd.h>
+#endif
#include <unistd.h>
#include <sys/wait.h>
#endif
@@ -257,10 +259,10 @@
#define H5_ATTR_NORETURN __attribute__((noreturn))
#define H5_ATTR_CONST __attribute__((const))
#define H5_ATTR_PURE __attribute__((pure))
-#if defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
+#if defined(__clang__) || defined(__GNUC__) && __GNUC__ >= 7 && !defined(__INTEL_COMPILER)
#define H5_ATTR_FALLTHROUGH __attribute__((fallthrough));
#else
-#define H5_ATTR_FALLTHROUGH /*void*/
+#define H5_ATTR_FALLTHROUGH /* FALLTHROUGH */
#endif
#else
#define H5_ATTR_FORMAT(X, Y, Z) /*void*/
@@ -456,7 +458,7 @@
#define LOCK_UN 0x08
#endif /* H5_HAVE_FLOCK */
-/* Macros for enabling/disabling particular GCC warnings
+/* Macros for enabling/disabling particular GCC / clang warnings
*
* These are duplicated in H5FDmulti.c (we don't want to put them in the
* public header and the multi VFD can't use private headers). If you make
@@ -466,19 +468,45 @@
* http://www.dbp-consulting.com/tutorials/SuppressingGCCWarnings.html
* http://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas
*/
-/* These pragmas are only implemented usefully in gcc 4.6+ */
-#if ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406
-#define H5_GCC_DIAG_JOINSTR(x, y) x y
-#define H5_GCC_DIAG_DO_PRAGMA(x) _Pragma(#x)
-#define H5_GCC_DIAG_PRAGMA(x) H5_GCC_DIAG_DO_PRAGMA(GCC diagnostic x)
-
-#define H5_GCC_DIAG_OFF(x) H5_GCC_DIAG_PRAGMA(push) H5_GCC_DIAG_PRAGMA(ignored H5_GCC_DIAG_JOINSTR("-W", x))
-#define H5_GCC_DIAG_ON(x) H5_GCC_DIAG_PRAGMA(pop)
+#define H5_DIAG_JOINSTR(x, y) x y
+#define H5_DIAG_DO_PRAGMA(x) _Pragma(#x)
+#define H5_DIAG_PRAGMA(x) H5_DIAG_DO_PRAGMA(GCC diagnostic x)
+
+#define H5_DIAG_OFF(x) H5_DIAG_PRAGMA(push) H5_DIAG_PRAGMA(ignored H5_DIAG_JOINSTR("-W", x))
+#define H5_DIAG_ON(x) H5_DIAG_PRAGMA(pop)
+
+/* Macros for enabling/disabling particular GCC-only warnings.
+ * These pragmas are only implemented usefully in gcc 4.6+
+ */
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406)
+#define H5_GCC_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_GCC_DIAG_ON(x) H5_DIAG_ON(x)
#else
#define H5_GCC_DIAG_OFF(x)
#define H5_GCC_DIAG_ON(x)
#endif
+/* Macros for enabling/disabling particular clang-only warnings.
+ */
+#if defined(__clang__)
+#define H5_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_CLANG_DIAG_ON(x) H5_DIAG_ON(x)
+#else
+#define H5_CLANG_DIAG_OFF(x)
+#define H5_CLANG_DIAG_ON(x)
+#endif
+
+/* Macros for enabling/disabling particular GCC / clang warnings.
+ * These macros should be used for warnings supported by both gcc and clang.
+ */
+#if (((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) || defined(__clang__)
+#define H5_GCC_CLANG_DIAG_OFF(x) H5_DIAG_OFF(x)
+#define H5_GCC_CLANG_DIAG_ON(x) H5_DIAG_ON(x)
+#else
+#define H5_GCC_CLANG_DIAG_OFF(x)
+#define H5_GCC_CLANG_DIAG_ON(x)
+#endif
+
/* Typedefs and functions for timing certain parts of the library. */
/* A set of elapsed/user/system times emitted as a time point by the
@@ -2227,7 +2255,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
* Use this macro for API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are: H5TSmutex_acquire,
+ * API name itself. Examples are: H5TSmutex_acquire,
*
*/
#define FUNC_ENTER_API_NAMECHECK_ONLY \
@@ -2323,7 +2351,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
* Use this macro for non-API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are private routines in the H5TS package.
+ * API name itself. Examples are private routines in the H5TS package.
*
*/
#define FUNC_ENTER_NOAPI_NAMECHECK_ONLY \
@@ -2401,7 +2429,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props);
* Use this macro for non-API functions that shouldn't perform _any_ initialization
* of the library or an interface, or push themselves on the function
* stack, or perform tracing, etc. This macro _only_ sanity checks the
- * API name itself. Examples are static routines in the H5TS package.
+ * API name itself. Examples are static routines in the H5TS package.
*
*/
#define FUNC_ENTER_STATIC_NAMECHECK_ONLY \
diff --git a/src/H5public.h b/src/H5public.h
index e192de0..163deed 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -56,8 +56,12 @@
#ifdef H5_HAVE_PARALLEL
/* Don't link against MPI C++ bindings */
+#ifndef MPICH_SKIP_MPICXX
#define MPICH_SKIP_MPICXX 1
-#define OMPI_SKIP_MPICXX 1
+#endif
+#ifndef OMPI_SKIP_MPICXX
+#define OMPI_SKIP_MPICXX 1
+#endif
#include <mpi.h>
#ifndef MPI_FILE_NULL /* MPIO may be defined in mpi.h already */
#include <mpio.h>
@@ -79,15 +83,15 @@
/**
* For tweaks, bug-fixes, or development
*/
-#define H5_VERS_RELEASE 0
+#define H5_VERS_RELEASE 1
/**
* For pre-releases like \c snap0. Empty string for official releases.
*/
-#define H5_VERS_SUBRELEASE ""
+#define H5_VERS_SUBRELEASE "1"
/**
* Full version string
*/
-#define H5_VERS_INFO "HDF5 library version: 1.13.0"
+#define H5_VERS_INFO "HDF5 library version: 1.13.1-1"
#define H5check() H5check_version(H5_VERS_MAJOR, H5_VERS_MINOR, H5_VERS_RELEASE)
@@ -168,8 +172,9 @@
* Status return values. Failed integer functions in HDF5 result almost
* always in a negative value (unsigned failing functions sometimes return
* zero for failure) while successful return is non-negative (often zero).
- * The negative failure value is most commonly -1, but don't bet on it. The
- * proper way to detect failure is something like:
+ * The negative failure value is most commonly -1, but don't bet on it.
+ *
+ * The proper way to detect failure is something like:
* \code
* if((dset = H5Dopen2(file, name)) < 0)
* fprintf(stderr, "unable to open the requested dataset\n");
@@ -178,11 +183,17 @@
typedef int herr_t;
/**
- * Boolean type. Successful return values are zero (false) or positive
- * (true). The typical true value is 1 but don't bet on it. Boolean
- * functions cannot fail. Functions that return #htri_t however return zero
- * (false), positive (true), or negative (failure). The proper way to test
- * for truth from a #htri_t function is:
+ * C99-style Boolean type. Successful return values are zero (false) or positive
+ * (true). The typical true value is 1 but don't bet on it.
+ * \attention Boolean functions cannot fail.
+ */
+#include <stdbool.h>
+typedef bool hbool_t;
+/**
+ * Three-valued Boolean type. Functions that return #htri_t however return zero
+ * (false), positive (true), or negative (failure).
+ *
+ * The proper way to test for truth from a #htri_t function is:
* \code
* if ((retval = H5Tcommitted(type)) > 0) {
* printf("data type is committed\n");
@@ -193,8 +204,7 @@ typedef int herr_t;
* }
* \endcode
*/
-typedef bool hbool_t;
-typedef int htri_t;
+typedef int htri_t;
/* The signed version of size_t
*
@@ -281,9 +291,9 @@ typedef enum {
/* (Actually, any positive value will cause the iterator to stop and pass back
* that positive value to the function that called the iterator)
*/
-#define H5_ITER_ERROR (-1)
-#define H5_ITER_CONT (0)
-#define H5_ITER_STOP (1)
+#define H5_ITER_ERROR (-1) /**< Error, stop iteration */
+#define H5_ITER_CONT (0) /**< Continue iteration */
+#define H5_ITER_STOP (1) /**< Stop iteration, short-circuit success */
//! <!-- [H5_index_t_snip] -->
/**
diff --git a/src/H5system.c b/src/H5system.c
index adfb758..e671ea9 100644
--- a/src/H5system.c
+++ b/src/H5system.c
@@ -732,8 +732,8 @@ H5_build_extpath(const char *name, char **extpath /*out*/)
HDstrncpy(full_path, cwdpath, cwdlen + 1);
if (!H5_CHECK_DELIMITER(cwdpath[cwdlen - 1]))
- HDstrncat(full_path, H5_DIR_SEPS, HDstrlen(H5_DIR_SEPS));
- HDstrncat(full_path, new_name, HDstrlen(new_name));
+ HDstrncat(full_path, H5_DIR_SEPS, path_len - (cwdlen + 1));
+ HDstrncat(full_path, new_name, path_len - (cwdlen + 1) - HDstrlen(H5_DIR_SEPS));
} /* end if */
} /* end else */
@@ -1098,8 +1098,8 @@ const char *H5_optarg; /* Flag argument (or value) */
int
H5_get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts)
{
- static int sp = 1; /* character index in current token */
- int optopt = '?'; /* option character passed back to user */
+ static int sp = 1; /* character index in current token */
+ int optchar = '?'; /* option character passed back to user */
if (sp == 1) {
/* check for more flag-like tokens */
@@ -1130,7 +1130,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon
for (i = 0; l_opts && l_opts[i].name; i++) {
if (HDstrcmp(arg, l_opts[i].name) == 0) {
/* we've found a matching long command line flag */
- optopt = l_opts[i].shortval;
+ optchar = l_opts[i].shortval;
if (l_opts[i].has_arg != no_arg) {
if (H5_optarg == NULL) {
@@ -1143,7 +1143,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon
if (H5_opterr)
HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg);
- optopt = '?';
+ optchar = '?';
}
}
}
@@ -1152,7 +1152,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon
if (H5_opterr)
HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg);
- optopt = '?';
+ optchar = '?';
}
}
break;
@@ -1164,7 +1164,7 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon
if (H5_opterr)
HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg);
- optopt = '?';
+ optchar = '?';
}
H5_optind++;
@@ -1176,11 +1176,11 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon
register char *cp; /* pointer into current token */
/* short command line option */
- optopt = argv[H5_optind][sp];
+ optchar = argv[H5_optind][sp];
- if (optopt == ':' || (cp = HDstrchr(opts, optopt)) == 0) {
+ if (optchar == ':' || (cp = HDstrchr(opts, optchar)) == 0) {
if (H5_opterr)
- HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optopt);
+ HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optchar);
/* if no chars left in this token, move to next token */
if (argv[H5_optind][++sp] == '\0') {
@@ -1198,9 +1198,9 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon
}
else if (++H5_optind >= argc) {
if (H5_opterr)
- HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optopt);
+ HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optchar);
- optopt = '?';
+ optchar = '?';
}
else {
/* flag value is next token */
@@ -1238,5 +1238,5 @@ H5_get_option(int argc, const char **argv, const char *opts, const struct h5_lon
}
/* return the current flag character found */
- return optopt;
+ return optchar;
}
diff --git a/src/H5trace.c b/src/H5trace.c
index e33bc12..8daa17d 100644
--- a/src/H5trace.c
+++ b/src/H5trace.c
@@ -1083,6 +1083,15 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'C': /* H5ES_event_complete_func_t */
+ {
+ H5ES_event_complete_func_t cfunc =
+ (H5ES_event_complete_func_t)HDva_arg(ap, H5ES_event_complete_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)cfunc);
+ } /* end block */
+ break;
+
case 'd': /* H5E_direction_t */
{
H5E_direction_t direction = (H5E_direction_t)HDva_arg(ap, int);
@@ -1111,6 +1120,15 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'I': /* H5ES_event_insert_func_t */
+ {
+ H5ES_event_insert_func_t ifunc =
+ (H5ES_event_insert_func_t)HDva_arg(ap, H5ES_event_insert_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)ifunc);
+ } /* end block */
+ break;
+
case 's': /* H5ES_status_t */
{
H5ES_status_t status = (H5ES_status_t)HDva_arg(ap, int);
@@ -1124,6 +1142,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5ES_STATUS_SUCCEED");
break;
+ case H5ES_STATUS_CANCELED:
+ H5RS_acat(rs, "H5ES_STATUS_CANCELED");
+ break;
+
case H5ES_STATUS_FAIL:
H5RS_acat(rs, "H5ES_STATUS_FAIL");
break;
@@ -1467,6 +1489,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
+ case 'c': /* H5_atclose_func_t */
+ {
+ H5_atclose_func_t cfunc = (H5_atclose_func_t)HDva_arg(ap, H5_atclose_func_t);
+
+ H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)cfunc);
+ } /* end block */
+ break;
+
case 's': /* hssize_t */
{
hssize_t hssize = HDva_arg(ap, hssize_t);
@@ -1533,10 +1563,8 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5T_NATIVE_FLOAT");
else if (obj == H5T_NATIVE_DOUBLE_g)
H5RS_acat(rs, "H5T_NATIVE_DOUBLE");
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (obj == H5T_NATIVE_LDOUBLE_g)
H5RS_acat(rs, "H5T_NATIVE_LDOUBLE");
-#endif
else if (obj == H5T_IEEE_F32BE_g)
H5RS_acat(rs, "H5T_IEEE_F32BE");
else if (obj == H5T_IEEE_F32LE_g)
@@ -2873,6 +2901,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_ATTR_DELETE");
break;
+ case H5VL_ATTR_DELETE_BY_IDX:
+ H5RS_acat(rs, "H5VL_ATTR_DELETE_BY_IDX");
+ break;
+
case H5VL_ATTR_EXISTS:
H5RS_acat(rs, "H5VL_ATTR_EXISTS");
break;
@@ -2901,10 +2933,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_BLOB_DELETE");
break;
- case H5VL_BLOB_GETSIZE:
- H5RS_acat(rs, "H5VL_BLOB_GETSIZE");
- break;
-
case H5VL_BLOB_ISNULL:
H5RS_acat(rs, "H5VL_BLOB_ISNULL");
break;
@@ -2985,10 +3013,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_DATASET_REFRESH");
break;
- case H5VL_DATASET_WAIT:
- H5RS_acat(rs, "H5VL_DATASET_WAIT");
- break;
-
default:
H5RS_asprintf_cat(rs, "%ld", (long)specific);
break;
@@ -3001,6 +3025,10 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5VL_datatype_get_t get = (H5VL_datatype_get_t)HDva_arg(ap, int);
switch (get) {
+ case H5VL_DATATYPE_GET_BINARY_SIZE:
+ H5RS_acat(rs, "H5VL_DATATYPE_GET_BINARY_SIZE");
+ break;
+
case H5VL_DATATYPE_GET_BINARY:
H5RS_acat(rs, "H5VL_DATATYPE_GET_BINARY");
break;
@@ -3093,14 +3121,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_FILE_REOPEN");
break;
- case H5VL_FILE_MOUNT:
- H5RS_acat(rs, "H5VL_FILE_MOUNT");
- break;
-
- case H5VL_FILE_UNMOUNT:
- H5RS_acat(rs, "H5VL_FILE_UNMOUNT");
- break;
-
case H5VL_FILE_IS_ACCESSIBLE:
H5RS_acat(rs, "H5VL_FILE_IS_ACCESSIBLE");
break;
@@ -3113,10 +3133,6 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5RS_acat(rs, "H5VL_FILE_IS_EQUAL");
break;
- case H5VL_FILE_WAIT:
- H5RS_acat(rs, "H5VL_FILE_WAIT");
- break;
-
default:
H5RS_asprintf_cat(rs, "%ld", (long)specific);
break;
@@ -3149,6 +3165,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5VL_group_specific_t specific = (H5VL_group_specific_t)HDva_arg(ap, int);
switch (specific) {
+ case H5VL_GROUP_MOUNT:
+ H5RS_acat(rs, "H5VL_GROUP_MOUNT");
+ break;
+
+ case H5VL_GROUP_UNMOUNT:
+ H5RS_acat(rs, "H5VL_GROUP_UNMOUNT");
+ break;
+
case H5VL_GROUP_FLUSH:
H5RS_acat(rs, "H5VL_GROUP_FLUSH");
break;
@@ -3164,9 +3188,9 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
} /* end block */
break;
- case 'k': /* H5VL_link_create_type_t */
+ case 'k': /* H5VL_link_create_t */
{
- H5VL_link_create_type_t create = (H5VL_link_create_type_t)HDva_arg(ap, int);
+ H5VL_link_create_t create = (H5VL_link_create_t)HDva_arg(ap, int);
switch (create) {
case H5VL_LINK_CREATE_HARD:
@@ -3334,22 +3358,14 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap)
H5VL_request_specific_t specific = (H5VL_request_specific_t)HDva_arg(ap, int);
switch (specific) {
- case H5VL_REQUEST_WAITANY:
- H5RS_acat(rs, "H5VL_REQUEST_WAITANY");
- break;
-
- case H5VL_REQUEST_WAITSOME:
- H5RS_acat(rs, "H5VL_REQUEST_WAITSOME");
- break;
-
- case H5VL_REQUEST_WAITALL:
- H5RS_acat(rs, "H5VL_REQUEST_WAITALL");
- break;
-
case H5VL_REQUEST_GET_ERR_STACK:
H5RS_acat(rs, "H5VL_REQUEST_GET_ERR_STACK");
break;
+ case H5VL_REQUEST_GET_EXEC_TIME:
+ H5RS_acat(rs, "H5VL_REQUEST_GET_EXEC_TIME");
+ break;
+
default:
H5RS_asprintf_cat(rs, "%ld", (long)specific);
break;
diff --git a/src/H5win32defs.h b/src/H5win32defs.h
index 030b65b..44cf50c 100644
--- a/src/H5win32defs.h
+++ b/src/H5win32defs.h
@@ -80,7 +80,7 @@ struct timezone {
#define HDstrtok_r(X, Y, Z) strtok_s(X, Y, Z)
#define HDtzset() _tzset()
#define HDunlink(S) _unlink(S)
-#define HDunsetenv(N, V, O) Wsetenv(N, "", 1)
+#define HDunsetenv(N) Wsetenv(N, "", 1)
#define HDwrite(F, M, Z) _write(F, M, Z)
#ifndef H5_HAVE_MINGW
diff --git a/src/Makefile.am b/src/Makefile.am
index 37ff850..ae058f4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -108,11 +108,11 @@ libhdf5_la_SOURCES= H5.c H5checksum.c H5dbg.c H5lib_settings.c H5system.c \
H5Torder.c H5Tref.c H5Tpad.c H5Tprecis.c H5Tstrpad.c H5Tvisit.c \
H5Tvlen.c \
H5TS.c \
- H5VL.c H5VLcallback.c H5VLint.c H5VLnative.c \
+ H5VL.c H5VLcallback.c H5VLdyn_ops.c H5VLint.c H5VLnative.c \
H5VLnative_attr.c H5VLnative_blob.c H5VLnative_dataset.c \
H5VLnative_datatype.c H5VLnative_file.c H5VLnative_group.c \
H5VLnative_link.c H5VLnative_introspect.c H5VLnative_object.c \
- H5VLnative_token.c H5VLpassthru.c \
+ H5VLnative_token.c H5VLpassthru.c H5VLtest.c \
H5VM.c H5WB.c H5Z.c \
H5Zdeflate.c H5Zfletcher32.c H5Znbit.c H5Zshuffle.c H5Zscaleoffset.c \
H5Zszip.c H5Ztrans.c
@@ -160,7 +160,7 @@ include_HEADERS = hdf5.h H5api_adpt.h H5overflow.h H5pubconf.h H5public.h H5vers
H5Zpublic.h
# Public component author headers
-include_HEADERS += H5FDdevelop.h H5Idevelop.h H5Ldevelop.h \
+include_HEADERS += H5ESdevelop.h H5FDdevelop.h H5Idevelop.h H5Ldevelop.h \
H5Tdevelop.h H5TSdevelop.h H5Zdevelop.h
# install libhdf5.settings in lib directory
diff --git a/src/hdf5.h b/src/hdf5.h
index b4ece16..9236f2c 100644
--- a/src/hdf5.h
+++ b/src/hdf5.h
@@ -42,6 +42,7 @@
#include "H5Zpublic.h" /* Data filters */
/* Plugin/component developer headers */
+#include "H5ESdevelop.h" /* Event Sets */
#include "H5FDdevelop.h" /* File drivers */
#include "H5Idevelop.h" /* ID management */
#include "H5Ldevelop.h" /* Links */
@@ -52,6 +53,7 @@
/* Virtual object layer (VOL) connector developer support */
#include "H5VLconnector.h" /* VOL connector author routines */
#include "H5VLconnector_passthru.h" /* Pass-through VOL connector author routines */
+#include "H5VLnative.h" /* Native VOL connector macros, for VOL connector authors */
/* Predefined file drivers */
#include "H5FDcore.h" /* Files stored entirely in memory */
diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in
index 44c1540..7fe1a36 100644
--- a/src/libhdf5.settings.in
+++ b/src/libhdf5.settings.in
@@ -67,28 +67,29 @@ Languages:
Features:
---------
- Parallel HDF5: @PARALLEL@
-Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
- Large Parallel I/O: @LARGE_PARALLEL_IO@
- High-level library: @HDF5_HL@
- Build HDF5 Tests: @HDF5_TESTS@
- Build HDF5 Tools: @HDF5_TOOLS@
- Threadsafety: @THREADSAFE@
- Default API mapping: @DEFAULT_API_VERSION@
- With deprecated public symbols: @DEPRECATED_SYMBOLS@
- I/O filters (external): @EXTERNAL_FILTERS@
- MPE: @MPE@
- Map (H5M) API: @MAP_API@
- Direct VFD: @DIRECT_VFD@
- Mirror VFD: @MIRROR_VFD@
- (Read-Only) S3 VFD: @ROS3_VFD@
- (Read-Only) HDFS VFD: @HAVE_LIBHDFS@
- dmalloc: @HAVE_DMALLOC@
- Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@
- API tracing: @TRACE_API@
- Using memory checker: @USINGMEMCHECKER@
- Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
- Function stack tracing: @CODESTACK@
- Use file locking: @DESIRED_FILE_LOCKING@
- Strict file format checks: @STRICT_FORMAT_CHECKS@
- Optimization instrumentation: @INSTRUMENT_LIBRARY@
+ Parallel HDF5: @PARALLEL@
+ Parallel Filtered Dataset Writes: @PARALLEL_FILTERED_WRITES@
+ Large Parallel I/O: @LARGE_PARALLEL_IO@
+ High-level library: @HDF5_HL@
+Dimension scales w/ new references: @DIMENSION_SCALES_WITH_NEW_REF@
+ Build HDF5 Tests: @HDF5_TESTS@
+ Build HDF5 Tools: @HDF5_TOOLS@
+ Threadsafety: @THREADSAFE@
+ Default API mapping: @DEFAULT_API_VERSION@
+ With deprecated public symbols: @DEPRECATED_SYMBOLS@
+ I/O filters (external): @EXTERNAL_FILTERS@
+ MPE: @MPE@
+ Map (H5M) API: @MAP_API@
+ Direct VFD: @DIRECT_VFD@
+ Mirror VFD: @MIRROR_VFD@
+ (Read-Only) S3 VFD: @ROS3_VFD@
+ (Read-Only) HDFS VFD: @HAVE_LIBHDFS@
+ dmalloc: @HAVE_DMALLOC@
+ Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@
+ API tracing: @TRACE_API@
+ Using memory checker: @USINGMEMCHECKER@
+ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@
+ Function stack tracing: @CODESTACK@
+ Use file locking: @DESIRED_FILE_LOCKING@
+ Strict file format checks: @STRICT_FORMAT_CHECKS@
+ Optimization instrumentation: @INSTRUMENT_LIBRARY@
diff --git a/src/uthash.h b/src/uthash.h
index 8bdca55..ea99839 100644
--- a/src/uthash.h
+++ b/src/uthash.h
@@ -714,25 +714,35 @@ typedef unsigned char uint8_t;
hashv += (unsigned)(keylen); \
switch (_hj_k) { \
case 11: \
- hashv += ((unsigned)_hj_key[10] << 24); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[10] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 10: \
- hashv += ((unsigned)_hj_key[9] << 16); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[9] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 9: \
- hashv += ((unsigned)_hj_key[8] << 8); /* FALLTHROUGH */ \
+ hashv += ((unsigned)_hj_key[8] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 8: \
- _hj_j += ((unsigned)_hj_key[7] << 24); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[7] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 7: \
- _hj_j += ((unsigned)_hj_key[6] << 16); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[6] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 6: \
- _hj_j += ((unsigned)_hj_key[5] << 8); /* FALLTHROUGH */ \
+ _hj_j += ((unsigned)_hj_key[5] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 5: \
- _hj_j += _hj_key[4]; /* FALLTHROUGH */ \
+ _hj_j += _hj_key[4]; \
+ H5_ATTR_FALLTHROUGH \
case 4: \
- _hj_i += ((unsigned)_hj_key[3] << 24); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[3] << 24); \
+ H5_ATTR_FALLTHROUGH \
case 3: \
- _hj_i += ((unsigned)_hj_key[2] << 16); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[2] << 16); \
+ H5_ATTR_FALLTHROUGH \
case 2: \
- _hj_i += ((unsigned)_hj_key[1] << 8); /* FALLTHROUGH */ \
+ _hj_i += ((unsigned)_hj_key[1] << 8); \
+ H5_ATTR_FALLTHROUGH \
case 1: \
_hj_i += _hj_key[0]; \
} \